By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,949 Members | 890 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,949 IT Pros & Developers. It's quick & easy.

IE6 weird background bug.

P: n/a
Here's the problem as far as I can work out (not a problem in firefox
or ie7)

I have pages with a body with a ID and class. The ID is the page
type, in this case Sub, and with a class of the type of instrument,
this can be guitar, bass, vocal and drum.

So body looks like <body id="sub" class="guitar" or <body
id="sub" class="bass">

Now what I want to do is change the background according to which class
the body has.

So I'm using..

body#sub.bass
{
background: #7a7a7a repeat-x url(img/bg_basssubstars.jpg) ;
}

then

body#sub.guitar
{
background: #7a7a7a repeat-x url(img/bg_guitarsubstars.jpg) ;
}
BUT in IE 6 the second (and third and fourth) attempt to set the
background is ignored. Anyone got any fix other than removing the class
and just using the ID (easier said than done)?

I'm relatively new to CSS so be gentle.

Stew Dean.

Oct 18 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a

st******@gmail.com wrote:
Here's the problem as far as I can work out
We need a URL. You have a non-trivial problem and we need to see the
whole picture.
I have pages with a body with a ID and class. The ID is the page
type, in this case Sub, and with a class of the type of instrument,
In general, use class for CSS and not id. You certainly can use id, but
it tends to work better with classes (id is very "strong" in CSS
selectors, so it can get awkward to "sub-class" behaviours on a class
that's already inside an element with a matching id). You can also use
multiple classes on the same element (they go in one class attribute,
separated by spaces).

BUT in IE 6 the second (and third and fourth) attempt to set the
background is ignored.
Validate your code (HTML and CSS) and check that the image URLs
actually work. Chances are that it's some dumb typo you're staring
right at but haven't noticed.

Oct 18 '06 #2

P: n/a

Andy Dingley wrote:
st******@gmail.com wrote:
Here's the problem as far as I can work out

We need a URL. You have a non-trivial problem and we need to see the
whole picture.
Fair enough- but bear in mind this is work in progress...

http://gutiarinstitute.fastnet.co.uk...es/guitar.aspx

I have pages with a body with a ID and class. The ID is the page
type, in this case Sub, and with a class of the type of instrument,

In general, use class for CSS and not id. You certainly can use id, but
it tends to work better with classes (id is very "strong" in CSS
selectors, so it can get awkward to "sub-class" behaviours on a class
that's already inside an element with a matching id). You can also use
multiple classes on the same element (they go in one class attribute,
separated by spaces).
Okay. The natural quesiton would then be if the body has two classes
how do I refer to a page that has both? .sub .bass { foo:bar; }?
BUT in IE 6 the second (and third and fourth) attempt to set the
background is ignored.

Validate your code (HTML and CSS) and check that the image URLs
actually work. Chances are that it's some dumb typo you're staring
right at but haven't noticed.
Yeah - usualy is, the HTML validates, CSS appears to be okay on
validating as well.

Stew Dean

Oct 18 '06 #3

P: n/a

Andy Dingley wrote:
st******@gmail.com wrote:
Here's the problem as far as I can work out

We need a URL. You have a non-trivial problem and we need to see the
whole picture.
Fair enough- but bear in mind this is work in progress...

http://guitarinstitute.fastnet.co.uk...es/guitar.aspx

I have pages with a body with a ID and class. The ID is the page
type, in this case Sub, and with a class of the type of instrument,

In general, use class for CSS and not id. You certainly can use id, but
it tends to work better with classes (id is very "strong" in CSS
selectors, so it can get awkward to "sub-class" behaviours on a class
that's already inside an element with a matching id). You can also use
multiple classes on the same element (they go in one class attribute,
separated by spaces).
Okay. The natural quesiton would then be if the body has two classes
how do I refer to a page that has both? .sub .bass { foo:bar; }?
BUT in IE 6 the second (and third and fourth) attempt to set the
background is ignored.

Validate your code (HTML and CSS) and check that the image URLs
actually work. Chances are that it's some dumb typo you're staring
right at but haven't noticed.
Yeah - usualy is, the HTML validates, CSS appears to be okay on
validating as well.

Stew Dean

Oct 18 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.