CSS by Browser
You write good HTML and good CSS.
In Firefox, the most standards-compliant browser, everything works just fine without you having to hack the CSS.
Then in IE6 you have to do some hacks to get it to work.
MS then releases IE7, it's most standards-compliant browser to date.
You now have to have separate styles for Firefox, IE6 and now IE7.
Here's how you deliver a stylesheet based on browser detection by placing some code within the page's <head> tags...
For example... If the new IE7 is more compliant and works with similar styles to Firefox then we need to introduce a CSS detector for IE6 or less...
Now, what about all the other browsers, how do you name and identify them?
Browser Codes [browser]:
In Firefox, the most standards-compliant browser, everything works just fine without you having to hack the CSS.
Then in IE6 you have to do some hacks to get it to work.
MS then releases IE7, it's most standards-compliant browser to date.
You now have to have separate styles for Firefox, IE6 and now IE7.
Here's how you deliver a stylesheet based on browser detection by placing some code within the page's <head> tags...
For example... If the new IE7 is more compliant and works with similar styles to Firefox then we need to introduce a CSS detector for IE6 or less...
<!--[if lt IE 7]><br /><link href="/stylesfolder/mystylesheetfor_ie6.css" rel="stylesheet" type="text/css"><br /><![endif]-->The first line asks if "Less Than IE7" then deliver the specific stylesheet for IE6 and under so this would also be valid...
<!--[if lte IE 6]><br /><link href="/stylesfolder/mystylesheetfor_ie6.css" rel="stylesheet" type="text/css"><br /><![endif]-->The first line is asking if "Less Than or Equal to IE6" so performs the same job.
Now, what about all the other browsers, how do you name and identify them?
Browser Codes [browser]:
- gecko - Mozilla, Firefox, Camino
- ie - Internet Explorer (All versions)
- ie6 - Internet Explorer 6.x
- ie5 - Internet Explorer 5.x
- opera - Opera (All versions)
- opera8 - Opera 8.x
- opera9 - Opera 9.x
- konqueror - Konqueror
- webkit or safari - Safari, NetNewsWire, OmniWeb, Shiira

0 Comments:
Post a Comment
Links to this post:
Create a Link
<< Home