"Backwards Compatable" HTML Coding?

S

SATAN

I'm making a page and using CSS to make the background image
fixed, specifically:

body {background-attachment: fixed; background-image: url(back.gif);}

I checked the page on a couple of browsers and it seems that
Netscape 4.8 (and I would imagine earlier) doesn't recognize the
CSS code and shows nothing for a background image.

My question is would it be valid to *ALSO* specify the background
image in the body tag thereby making it "backwards compatable" for
older browsers that don't recognize the CSS?

I tried it and it seems to work; NS 4.8 shows the background image
and scrolls it with the page and IE 5.5 as well as Opera 7.4 both
show the image as fixed.

Does CSS normally override any "ordinary" HTML attributes in CSS
aware browsers (as it seems to in this example)?

Is doing what I did in this example considered valid HTML?

Thanks!
 
S

Sid Ismail

: I'm making a page and using CSS to make the background image
: fixed, specifically:
:
: body {background-attachment: fixed; background-image: url(back.gif);}
:
: I checked the page on a couple of browsers and it seems that
: Netscape 4.8 (and I would imagine earlier) doesn't recognize the
: CSS code and shows nothing for a background image.


Netscape 4.x doesn't do a lot of things. No, not even native HTML commands
help with this one... with that browser. Ask your visitors to upgrade.

Sid
 
S

SATAN

I believe it was Sid Ismail <[email protected]>
who thought we would be interested in the following:

-> On Tue, 10 Aug 2004 16:09:12 +0000, SATAN <[email protected]>
-> wrote:
->
-> : I'm making a page and using CSS to make the background image
-> : fixed, specifically:
-> :
-> : body {background-attachment: fixed; background-image: url(back.gif);}
-> :
-> : I checked the page on a couple of browsers and it seems that
-> : Netscape 4.8 (and I would imagine earlier) doesn't recognize the
-> : CSS code and shows nothing for a background image.
->
->
-> Netscape 4.x doesn't do a lot of things. No, not even native HTML commands
-> help with this one... with that browser. Ask your visitors to upgrade.

Assuming that nobody is going to consider upgrading their browser
just to see my background image all I want to know is if specifying
a background image in both the body tag *and* in a style sheet is
valid HTML.

And will the CSS take precedence over this "mix" in browsers that
make proper use of CSS, or is the extra specification of a background
image going to mess anything up.
 
N

Neal

Assuming that nobody is going to consider upgrading their browser
just to see my background image all I want to know is if specifying
a background image in both the body tag *and* in a style sheet is
valid HTML.

And will the CSS take precedence over this "mix" in browsers that
make proper use of CSS, or is the extra specification of a background
image going to mess anything up.

While I don't know the answer off my head, I know how I'd find it. Set up
a test page with a background in the body tag and a different image in the
CSS. Then try the page in various browsers.

My guess is that the body tag will override the CSS.
 
S

Sam Hughes

I'm making a page and using CSS to make the background image
fixed, specifically:

body {background-attachment: fixed; background-image: url(back.gif);}

I checked the page on a couple of browsers and it seems that
Netscape 4.8 (and I would imagine earlier) doesn't recognize the
CSS code and shows nothing for a background image.

Bah, stop checking every browser in existence.

I forget all about NS 4 CSS difficulties, but try using background: COLOR
url(back.gif) fixed;

( replacing COLOR with "white" or "black" or #00dfe3 or whatever is
appropriate.)
My question is would it be valid to *ALSO* specify the background
image in the body tag thereby making it "backwards compatable" for
older browsers that don't recognize the CSS?

Depends one what specification you are validating to. Transitional, yes.
Does CSS normally override any "ordinary" HTML attributes in CSS
aware browsers (as it seems to in this example)?

Yes -- if you do the CSS font { font-size: 10em; }, <font size="2"> will
appear super big.

However, style attributes override CSS that lies in other places, barring
for example use of !important.
 
T

Toby Inkster

SATAN said:
all I want to know is if specifying a background image in both the body
tag *and* in a style sheet is valid HTML.

Yes, it's valid, but what's the point? Choose one or the other -- there is
no benefit in using both.
 
S

SATAN

I believe it was Sam Hughes <[email protected]>
who thought we would be interested in the following:

[...]

-> > My question is would it be valid to *ALSO* specify the background
-> > image in the body tag thereby making it "backwards compatable" for
-> > older browsers that don't recognize the CSS?
->
-> Depends one what specification you are validating to. Transitional, yes.

Sorry, I should have specified that.


-> > Does CSS normally override any "ordinary" HTML attributes in CSS
-> > aware browsers (as it seems to in this example)?
->
-> Yes -- if you do the CSS font { font-size: 10em; }, <font size="2"> will
-> appear super big.
->
-> However, style attributes override CSS that lies in other places, barring
-> for example use of !important.

Thank you; that's all I wanted to know.
 
S

SATAN

I believe it was Neal <[email protected]>
who thought we would be interested in the following:

[...]

-> > And will the CSS take precedence over this "mix" in browsers that
-> > make proper use of CSS, or is the extra specification of a background
-> > image going to mess anything up.
->
-> While I don't know the answer off my head, I know how I'd find it. Set up
-> a test page with a background in the body tag and a different image in the
-> CSS. Then try the page in various browsers.
->
-> My guess is that the body tag will override the CSS.

IE 5.5 and Opera 7.54 showed CSS image while NS 4.8 showed the body one.
 
S

SATAN

I believe it was Toby Inkster <[email protected]>
who thought we would be interested in the following:

-> SATAN wrote:
-> > all I want to know is if specifying a background image in both the body
-> > tag *and* in a style sheet is valid HTML.
->
-> Yes, it's valid, but what's the point? Choose one or the other -- there is
-> no benefit in using both.

The benefit is that people using 4.x versions of NS (and there's
still a decent number of them) will see the background image (even
if it's not fixed) rather than not seeing anything.
 
T

Toby Inkster

SATAN said:
The benefit is that people using 4.x versions of NS (and there's still a
decent number of them) will see the background image (even if it's not
fixed) rather than not seeing anything.

That's not a benefit of using both. That's a benefit of using <body
background="blah">. What advantage does using *both* have.

"Satan is my master. He has always been. He tells me what to do. He buys
my Metallica tickets for me. And sometime I say..."
 
S

SATAN

I believe it was Toby Inkster <[email protected]>
who thought we would be interested in the following:

-> >>> all I want to know is if specifying a background image in both the body
-> >>> tag *and* in a style sheet is valid HTML.
-> >>
-> >> Yes, it's valid, but what's the point? Choose one or the other -- there
-> >> is no benefit in using both.
-> >
-> > The benefit is that people using 4.x versions of NS (and there's still a
-> > decent number of them) will see the background image (even if it's not
-> > fixed) rather than not seeing anything.
->
-> That's not a benefit of using both.

Of course it is.


-> That's a benefit of using <body background="blah">. What advantage does
-> using *both* have.

The advantage of using both is that I want the background image to
be fixed but if that's not possible (as with NS 4.x) I at least want
NS 4.x people to see the image (even if it's not fixed).

If I only use CSS then the NS 4.x people won't see any image at all.

If I only use the body tag then *nobody* sees the image as fixed.

If I use *both* then most people will see the image as I intended
(fixed) and the NS 4.x people, while the image won't be fixed, will
at least *see* the image, which is better than not seeing it.
 
T

Toby Inkster

SATAN said:
If I only use the body tag then *nobody* sees the image as fixed.

<style type="text/css">
body { background-attachment: fixed; }
</style>
<body background="blah">
</body>
 
S

SATAN

I believe it was Toby Inkster <[email protected]>
who thought we would be interested in the following:

-> SATAN wrote:
->
-> > If I only use the body tag then *nobody* sees the image as fixed.
->
-> <style type="text/css">
-> body { background-attachment: fixed; }
-> </style>
-> <body background="blah">
-> </body>

Isn't that what I've been saying all along?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top