javascripthtmlcssinternet-explorer

What does these tags mean [if IE 8]?


I bought a template. There are some tags, which I don't understand:

<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->

What are these if-clause and what I have to do with them? Are they for the browser, and I don't have to do nothing with them, or I have to render them with PHP in someway?


Solution

  • If the user is viewing your site with Internet Explorer 8 (as an example), then your <html lang="en" class="no-js"> becomes <html lang="en" class="ie8 no-js"> (this could also be used to point the user to another stylesheet specifically for IE 8 as well).

    It was helpful for when you needed to correct a few things on your site that looked terrible for IE 8.

    They're no longer supported since IE 10 though.

    Regardless, you can just leave it the way it is.