CSS Margin Bug in IE

They have: 38 posts

Joined: Feb 2003

Hi, I'm designing a site and have decided to use CSS to give each of my tables a 5 pixel space around them.

Heres the code:

and her's the CSS:
.main_home {
margin-right:2px;
background-image:url(images/main_home_bg.gif)
}

.side_spreads {
background-image:url(images/side_spreads_bg.gif)
}

Now it works fine in Netscape and Opera but in Explorer the table named spreads is over to the right by 3 pixels, so there is actually 8 pixels of space in between Main and Spreads. I don't know if this is abug but if anyone knows how to fix this that would be great

Thanks in advance

Curtis

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

also, I think .side_spreads is not actually allowed. Use .side-spreads instead.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

No underscores in class names, yes, good catch. I don't think hyphens are allowed either. I recommend (and use) inner capitalization.

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

hyphens are allowed but isn't CSS supposed to be all in lower case?

He has: 1,758 posts

Joined: Jul 2002

i think the attributes do, but the class names etc can be mixed case.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

http://devedge.netscape.com/viewsource/2001/css-underscores/

no, it's not supposed to be all lowercase. lowercase elements, yes, especially when used with XHTML which is also all lowercase for elements and attributes (values are not). Not class and id names -- they are case sensitive.

Learned something new -- underscores are allowed now, however their support is still so poor that it's as if they aren't allowed. Wink

Also, a reminder that class names cannot start with a hyphen or a digit, only a letter (capitalized or not).

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.