Just Me Posted March 18, 2007 Share Posted March 18, 2007 sorry for my terrible english. i hope that you will understand me.I know how to detect the navigator used to read my page (with a javascript). But how write the HTML code to load the adapted stylesheet? example: somebody uses IE or Opera to see my site, i want that the HTML code detect it and load the stylesheet for IE or Opera. Link to comment Share on other sites More sharing options...
boen_robot Posted March 18, 2007 Share Posted March 18, 2007 Please don't do that.Firefox and Opera have great CSS support and it's quite easy to get your site looking good in both of them. IE is still the only browser to have problems with CSS. And for IE, you can use IE's conditional comments to insert a reference for the CSS file that only IE will be able to see. Do not use the code provided for "downlevel browsers" as it will make your HTML invalid.P.S. Browsers can identify themselves as other browsers, so this makes your JS unreliable. Link to comment Share on other sites More sharing options...
Anders Moen Posted March 19, 2007 Share Posted March 19, 2007 Make your site look good in Opera and FireFox, then IE because IE always comes with one or more problem which you can solve with this code: <!--[if IE]>The Style Sheet For IE<![endif]--> I use that code on several of my sites, because IE is not a good browser and MS still haven't gotten it unfortunely. Link to comment Share on other sites More sharing options...
Just Me Posted March 20, 2007 Author Share Posted March 20, 2007 Many Thanks to you, Boen robot and Andersmoen,i was on a wrong way and you helped me to spare a lot of time! Link to comment Share on other sites More sharing options...
ste Posted March 20, 2007 Share Posted March 20, 2007 personally i like to use css hacks such as the backlash hack. with a bit of noodling i can often solve IE related problems without having to introduce browser specific style sheets and conditional comments. the advantage of this is that you then only have 1 external style sheet to edit which after all is one of the great things about css. I would use conditional comments only as a last resort. Link to comment Share on other sites More sharing options...
Just Me Posted March 20, 2007 Author Share Posted March 20, 2007 It is going to drive me mad!!!I used conditionnal comments. I used W3C validators for my html code and for my stylesheets : everything OK! no problem with the names of sheets. A little script (alert) inside the cond. comment works correctly, and, guess what : IT DOESN'T WORK ! Link to comment Share on other sites More sharing options...
iyeru42 Posted March 20, 2007 Share Posted March 20, 2007 Are you using FF to view that conditional statement? Or any other browser besides IE? If so, you need to view it in IE. If not, please post what your script is (In a Code BBCode tag please.) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now