CSS Hacks

After two days reading all I could on the way Firefox and Internet Explorer render CSS differently, I've finally discovered the CSS hack. It has to do with using the html>body. Apparently, IE doesn't recognise this CSS code and so ignores it.

The way CSS hacks works is to send one CSS rule to the browser(s) you're trying to trick, and a second CSS rule that overrides the first command to the other browsers. If you have two CSS rules with identical selectors, the second CSS rule will almost always take precedence.
Trenton Moss

Since my Gallery looks perfect in Firefox with no CSS hacks, the browser I'm fooling is Internet Explorer. And it looks like you can use html>body as many times as you like throughout the stylesheet. I validated the CSS to find out, and it's valid!.

I applied the hack first to the banner, since the height and text were way out. It worked!! Next I applied the hack to the tabbed navigation, since it was out too. The problems were with height, padding, and font sizes. So my first style was for IE with smaller fonts and taller heights, and I added the html>body tag before each #banner and #tab-nav tags I wanted changed.

I didn't need javascript sniffers or multiple stylesheets, much to my relief. The only stylesheet I changed was the embedded-style.css in Gallery. For anyone interested in having Gallery integrated with Movable Type, Dlugosz.net has an excellent tutorial.

Leave a comment

Twitter Updates

Subscribe

Enter your Email


Preview | Powered by FeedBlitz

Archives

Powered by Movable Type 4.2rc4-en

Random Pix



The side of the house from the front before it was enclosed

The side of the house from the front before it was enclosed

Random Quote

Rev. Jesse Jackson

"You must never stop dreaming. Face reality, yes. But don't stop with the way things are; dream of things as they ought to be. Dream of peace. Peace is rational and reasonable. War is irrational in this age and unwinnable."

:: (1941~) American Activist, Clergyman, Politician

Recent Comments