Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS Underscore hack for IE - still relevant?

I'm looking at tidying the CSS for a large site to optimize it and noticed that throughout there are a lot of the old underscore hacks, e.g., _width:200px

I've tried looking online and am having trouble getting any answer post 2010. I'm getting the data through for how users are browsing the site and what browsers they're using but was wondering if it's now generally considered safe to remove these legacy hacks from files?

like image 223
user2212290 Avatar asked Mar 26 '13 15:03

user2212290


2 Answers

The underscore hack is only applicable to IE6 and older. If IE6 support is no longer needed, then it is safe to remove all occurrences of the hack (such as the example you have) from your stylesheets as they would otherwise never be used.

like image 159
BoltClock Avatar answered Sep 20 '22 18:09

BoltClock


Removing these hacks is recommended as IE6 usage is now minimal and keeping your code as clean and hack free as possible is to be desired.

But in the case that a user does use IE6 they should be informed that their browser isn't supported. From the HTML5 Boilerplate:

<!--[if lt IE 7]>
     <p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
<![endif]-->
like image 25
middleinitial Avatar answered Sep 16 '22 18:09

middleinitial