Different CSS files for Different Browsers

前端 未结 10 937
情深已故
情深已故 2020-12-17 07:48

I want to use different CSS files for different browser types. Is there any simple HTML code which can detect different types of browsers and include CSS files accordingly?<

10条回答
  •  醉梦人生
    2020-12-17 07:50

    You should consider to change your wish to use different style sheets for different browsers.

    Almost everything is possible to do with the same style sheet for all browsers. It requires a bit more work for making a clean markup and using robust styles, but what you gain is not just fewer css files, but a page that is very likely to work also in browsers that you have never heard of, and future versions of the browsers. Also a well thought out markup makes the page accessible for blind surfers, and it makes the job easier for search engines so that they are likely to index more of your content.

    That is what I have used on our company's web site. I didn't have to change a single thing to make it work when IE 8 was released. :)

    Note that a proper doctype is crucial for getting a concistent behaviour across browsers. Without it IE emulates most rendering errors back from IE 4, including an incorrect box model.

提交回复
热议问题