- This topic is empty.
-
AuthorPosts
-
December 24, 2016 at 11:32 am #249321PranabParticipant
Here is an example from the HTML5 Boilerplate:
<!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]--> <!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]--> <!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
what is the purpose of this?
December 24, 2016 at 12:00 pm #249323BeverleyhParticipantThe conditional comments allow different HTML elements, and therefore different browser-specific classes, to render in their respective browsers. It’s a way of identifying older versions of IE in order to apply specific styles.
If you need to research further, just Google “conditional comments”.
December 24, 2016 at 1:33 pm #249326BeverleyhParticipantSorry I misinterpreted – skim reading the post without reading the title. There is a ‘no-js’ class in the markup by default, and JavaScript removes it when JavaScript is available. When JavaScript isn’t available, for whatever reason, the class stays in the markup. It is so elements can be styled differently depending on whether JavaScript is available or not.
December 24, 2016 at 1:55 pm #249327PranabParticipantso if i don’t include this in html markup, then what happen? Is this necessary to include in every html page?and why js removes it? if not remove then what happen?
December 24, 2016 at 4:05 pm #249328BeverleyhParticipantso if i don’t include this in html markup, then what happen?
You won’t be able to apply styles for elements in no-js circumstances. You’d have to use some other fallback.
Is this necessary to include in every html page?
That depends if you’re using JavaScript to render critical elements. Again, you’d have to consider fallbacks for when JS is unavailable.
why js removes it?
To make its presence known and remove styles that have been applied in no-js circumstances.
if not remove then what happen?
The class remains in the markup and can be used to style elements differently when JS is unavailable.
This is all getting a bit repetitive so you should do some research via Google. Here’s a place to start
http://stackoverflow.com/questions/6724515/what-is-the-purpose-of-the-html-no-js-classDecember 24, 2016 at 4:11 pm #249329PranabParticipantthanks Beverleyh…
-
AuthorPosts
- The forum ‘Design’ is closed to new topics and replies.