CSS Battle: IE vs Firefox
Moderator: General Moderators
CSS Battle: IE vs Firefox
Any good tips for handling IE/Firefox compatible CSS?
I've got my pages displaying differently in the two browsers and I really don't want to have to manually define each item line by line.
-- Abe --
I've got my pages displaying differently in the two browsers and I really don't want to have to manually define each item line by line.
-- Abe --
Code: Select all
p {font-family: verdana; font-size: small}
#small {font-family: verdana; font-size: x-small}
img
{
border-style: none;
}
p.small {font-family: verdana; font-size: x-small}Code: Select all
print ("<p><a href=\"index.php?admincpcategories=1&subcatdeactivate=$subcatID\"><img src=\"../images/deactivate.gif\" alt=\"De-activate\"></a>
<a href=\"index.php?admincpcategories=1&submodify=$subcatID\"><img src=\"../images/mod.gif\" alt=\"Modify\"></a>
<b>$subcatName</b> (#$subcatID)</p>");- daedalus__
- DevNet Resident
- Posts: 1925
- Joined: Thu Feb 09, 2006 4:52 pm
- AKA Panama Jack
- Forum Regular
- Posts: 878
- Joined: Mon Nov 14, 2005 4:21 pm
I couldn't have said that better.bokehman wrote:Hmm! Personally that wouldn't be my recomendation. I'd say use CSS that is valid and that works and displays well in all browsers. Steer well clear of all solutions that aim to "fix" something in one browser.Roja wrote:use conditional statements for browser-specific issues.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
There are situations where you simply cannot do that. I'm not talking about whacky DHTML stuff neither. For example have you ever tried playing with padding/margin on order & unordered lists and viewing the result in IE then in other browsers?AKA Panama Jack wrote:I couldn't have said that better.bokehman wrote:Hmm! Personally that wouldn't be my recomendation. I'd say use CSS that is valid and that works and displays well in all browsers. Steer well clear of all solutions that aim to "fix" something in one browser.Roja wrote:use conditional statements for browser-specific issues.
Using conditional comments if far better than the underscore hack. Granted, you can work around most of the box model issues by simply nesting <div> elements to create a fake padding/margin.
I agree that conditional comments are the way to go.
What bokehman says is also true to some extent. You have to be careful with "fixes". Don't let them bite you ..
My approach is simple: start designing according to the standards, testing in a modern and standards supporting browser, for example Firefox.
Then, when your design is finished, start testing in other browsers and see if something's broken. Sometimes you don't have to do anything, other times something is broken in f.e. IE. Often, one or a few "fixes" in the css file specific for IE 5 or 6 is enough to get your layout working in that browser. Most often the problem has something to do with the box model or misinterpretation of floats. A search through positioniseverything.net will often help you find the problem.
The main advantage of using conditional comments is that all fixes for that browser are centralized. When it's time to ditch support for that browser, you'll only have to remove that css file. And your main stylesheets stay clean. Although I must admit i don't like the fact that the conditional comments are written in the html. It would be better to have them in the main css file in some way (like the MidPass filter from Tantek).
What bokehman says is also true to some extent. You have to be careful with "fixes". Don't let them bite you ..
My approach is simple: start designing according to the standards, testing in a modern and standards supporting browser, for example Firefox.
Then, when your design is finished, start testing in other browsers and see if something's broken. Sometimes you don't have to do anything, other times something is broken in f.e. IE. Often, one or a few "fixes" in the css file specific for IE 5 or 6 is enough to get your layout working in that browser. Most often the problem has something to do with the box model or misinterpretation of floats. A search through positioniseverything.net will often help you find the problem.
The main advantage of using conditional comments is that all fixes for that browser are centralized. When it's time to ditch support for that browser, you'll only have to remove that css file. And your main stylesheets stay clean. Although I must admit i don't like the fact that the conditional comments are written in the html. It would be better to have them in the main css file in some way (like the MidPass filter from Tantek).
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
I know this sounds foolish, harsh and arrogant, but I like to write standard compliant code. Hacks are a common thing because IE still chokes on a lot of standard stuff (can we say box model issues?). So naturally I am not a proponent for conditional loading of stylesheets. Almost any CSS compliance issue ca be reworked to make a close resemblance to conformance if you try hard enough and google enough.
Man, IE just chaps my... goodnight.
Man, IE just chaps my... goodnight.
IE 7 renders CSS much better than IE6, I've found that most websites that are well written render pretty much the same in IE7 as they do in firefox. I have had the odd exception (buttons wandering off page, and a menu bar disappearing) but on the whole its a vast improvment over how IE6 handles CSS, I'm hoping when MS finally releases it we will see an end to need to having to code for two different browsers 
- daedalus__
- DevNet Resident
- Posts: 1925
- Joined: Thu Feb 09, 2006 4:52 pm
That is just not true. Try viewing the acid test. This really shows how far behind the Gecko browsers it really is.phpdevuk wrote:IE 7 renders CSS much better than IE6, I've found that most websites that are well written render pretty much the same in IE7 as they do in firefox.
- AKA Panama Jack
- Forum Regular
- Posts: 878
- Joined: Mon Nov 14, 2005 4:21 pm
Download the latest version of Opera 9 and check out the Acid 2 Test. Opera 9 gets it right.bokehman wrote:That is just not true. Try viewing the acid test. This really shows how far behind the Gecko browsers it really is.phpdevuk wrote:IE 7 renders CSS much better than IE6, I've found that most websites that are well written render pretty much the same in IE7 as they do in firefox.