<script>if(BrowserDetect.browser=="safari"){document.write('<link rel="stylesheet" href="css/safari.css" type="text/css" media="all" />')}</script>
<!--[if lte IE 8]><link rel="stylesheet" type="text/css" href="css/pie.css" /><![endif]-->
Can I place conditional comments in the bottom of my html document? (in the body) or should it be in the head?
Placing those in the bottom is better in terms of page speed or not?
You can have conditional comments anywhere. Only the specified version of IE will parse the contents. In this case, where you have CSS in your conditional comment, it should be in your <head>
.
Also, it's not a good idea to use JS to insert a stylesheet. The user will see the unstyled (or incorrectly styled) content until the document.write
fires, and the css file loads. Insert with a server-side script such as PHP first.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With