Quantcast

CSS and IE

BikeGeek

BrewMonkey
Jul 2, 2001
4,574
274
Hershey, PA
Anyone good at cascading stylesheets? I'm setting up a <div> with a background image. The <div> contains a logo image (.png file).

The CSS:
div#bannerBox{
background-color: transparent;
background-image: url(images/banner.png);
height: 97px;
overflow: hidden;

}

img#logo{
position: absolute; top:6px; left:175px;

}

The html page references the CSS correctly and in the <body> I have:
<div id="bannerBox">
<img id="logo" src="images/logo.png">
</div>

In Firefox I get exactly what the code says I should: a header image with the logo overlayed at exactly where it's told to be. In IE the header image is behaving properly, but the logo image is at the top left of the page.

Any ideas?
 

BikeGeek

BrewMonkey
Jul 2, 2001
4,574
274
Hershey, PA
I found a workaround. I'm not sure the effect it will have when viewed with other browsers though.

I got rid of the image id styles and added "padding-left: 175px;" to the <div> style.

I'm still open to other ways if anyone knows.
 

Transcend

My Nuts Are Flat
Apr 18, 2002
18,040
3
Towing the party line.
You can easily set up different styles for different browsers. You have to hack crap all of the time because MS can't get their heads out of their asses.

html>body #bannerbox {
stuff:stuff;
}

IE will ignore this, and thus you can program it it's own #bannerbox div.
 

BikeGeek

BrewMonkey
Jul 2, 2001
4,574
274
Hershey, PA
Thanks. You're right, I'm finding all kinds of crap that IE doesn't support, or supports but only if it's worded the MicroSoft way. :rolleyes:
 

Transcend

My Nuts Are Flat
Apr 18, 2002
18,040
3
Towing the party line.
Ya, just ignore it. Code for Safari/Firefox or any other browser that reads standards properly, and then hack it to make IE work. That's the easiest way. Certain things for opera also require hacks, so it's best not to code in that either.