It would be great to have one tag that would output the conditional classes we are currently using on the templates for both us and the wdk users.
The conditional classes method is different to conditional stylesheets in that the <html> gets classes added based on which IE version it is (or not at all) enabling cross-browser styling hooks.
So as an IE8 user the html tag would be <html lang="en" class="no-js ie ie8 lt-ie10 lt-ie9">
This enables the following styling hooks
The browser is IE
… is explicitly IE8
… lower than both IE10 and 9
As an Opera user the html tag would be <html lang="en" class="no-js not-ie">
Enabling the styling hooks
The browser is not IE
Additionally the no-js class is included here for progressive enhancement. We use modernizr.js with our templates which, along with other feature detection tests, removes this class and replaces it with js if javascript is enabled.
It might be worth abstracting this no-js/js class swapping functionality out and including as part of this tag.
It would be great to have one tag that would output the conditional classes we are currently using on the templates for both us and the wdk users.
The conditional classes method is different to conditional stylesheets in that the
<html>
gets classes added based on which IE version it is (or not at all) enabling cross-browser styling hooks.Example from our templates
So as an IE8 user the html tag would be
<html lang="en" class="no-js ie ie8 lt-ie10 lt-ie9">
This enables the following styling hooks
As an Opera user the html tag would be
<html lang="en" class="no-js not-ie">
Enabling the styling hooks
Additionally the
no-js
class is included here for progressive enhancement. We use modernizr.js with our templates which, along with other feature detection tests, removes this class and replaces it withjs
if javascript is enabled.It might be worth abstracting this
no-js
/js
class swapping functionality out and including as part of this tag.