<p>I've seen people doing things like this in their HTML:</p>

<pre><code>&lt;!--[if IE]&gt;
  &lt;link rel="stylesheet" href="ie.css" type="text/css" /&gt;
&lt;![endif]--&gt;
</code></pre>

<p>Does this work across all modern browsers and is there a list of browser types that will work with that kind of if statement?</p>

<p><strong>Edit</strong></p>

<p>Thanks <a href="https://stackoverflow.com/questions/46124/is-there-a-list-of-browser-conditionals-for-use-including-stylesheets#46126">Ross</a>.  Interesting to find out about <strong>gt, lt, gte, &amp; lte</strong>.</p>

[{'answer_id': 46126, 'author': 'Ross', 'author_id': 2025, 'author_profile': 'https://Stackoverflow.com/users/2025', 'pm_score': 5, 'selected': True, 'text': '<p>This works across all browsers because anything except IE sees <code>&lt;!--IGNORED COMMENT--&gt;</code>. Only IE reads the comment if it contains a conditional clause. Have a look at <a href="http://www.quirksmode.org/css/condcom.html" rel="noreferrer">this article</a></p>\n\n<p>You can also specify which version of IE. For example:</p>\n\n<pre><code>&lt;!--[if IE 8]&gt;\n&lt;link rel="stylesheet type="text/css" href="ie8.css" /&gt;\n&lt;![endif]--&gt;\n</code></pre>\n'}, {'answer_id': 46163, 'author': 'Simon Johnson', 'author_id': 854, 'author_profile': 'https://Stackoverflow.com/users/854', 'pm_score': 1, 'selected': False, 'text': "<p>Further to Ross' answer, you can only target the Internet Explorer rendering engine with conditional comments; there is no similar construct for other browsers. For example, you can't write conditional comments that target Firefox, but are ignored by Internet Explorer. </p>\n\n<p>The way I achieve the same effect as your example above is to sniff the user agent string. I then deliver a suitable CSS file for that browser. This isn't perfect because sometimes people change their user-agent string for compatibility. </p>\n\n<p>The other way to target different browsers is to utilise browser specific hacks. These are particularly nasty because they usually rely on bugs in the browser and bugs are liable to be fixed!</p>\n\n<p>User-agent sniffing is the best all-round solution in my opinion.</p>\n"}, {'answer_id': 46244, 'author': 'sock', 'author_id': 4028, 'author_profile': 'https://Stackoverflow.com/users/4028', 'pm_score': 2, 'selected': False, 'text': '<p>If you can use Javascript, there are several options:</p>\n\n<pre><code>navigator.appName\nnavigator.appVersion \n</code></pre>\n\n<p><a href="http://www.w3schools.com/js/js_browser.asp" rel="nofollow noreferrer">link</a></p>\n\n<p>Or something more robust by using a library such as <a href="http://docs.jquery.com/Utilities/jQuery.browser" rel="nofollow noreferrer">jQuery</a>.</p>\n\n<p>Finally, you could use the <a href="http://www.quirksmode.org/js/detect.html" rel="nofollow noreferrer">BrowserDetect</a> object from QuirksMode.</p>\n\n<p>Once you have the browser name and version, you can then insert HTML to link to a style sheet or include other tags.</p>\n'}, {'answer_id': 134964, 'author': 'domgblackwell', 'author_id': 16954, 'author_profile': 'https://Stackoverflow.com/users/16954', 'pm_score': 2, 'selected': False, 'text': '<p>Conditional comments are purely for IE (version 5 and later). The official Microsoft documentation is <a href="http://msdn.microsoft.com/en-us/library/ms537512.aspx" rel="nofollow noreferrer">here</a>. If you are going to use them the best strategy is to conditionally include external stylesheets or javascript files after your normal includes. This means that on IE your IE-specific code will override everything else. On any other browser the code will be treated as comments and ignored by the parser.</p>\n'}]
['https://Stackoverflow.com/questions/46124', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/305/']