Best Practices for HTML(1) mistermario Save to my account Report List A few guidelines for HTML May 9, 2014 Uncategorized Verified List (1 votes) use utf-8 for your character sets use Paul Irish's IE conditional classes on the html tag to serve up specific IE fixes and non js content when setting the viewport tag, set initial scale to 1 but don't set max scale to 1 or disable the user's ability to scale on their own use a reset or "normalize" css sheet externalize your css and JavaScript minify javascript and combine where possible to reduce html requests put your js in the footer where possible and use 'lazy loading' where you can bring in common js libraries using an external CDN to take advantage of precaching don't keyword pack your metas. they probably don't do much good anyway. use modernizr js to sniff for browser features and degrade the experience gracefully use selectivzr js and PIE js to polyfill older legacy browsers. don't use it you don't need to. avoid inline and in page css and JavaScript where possible remember to only use an id once in a page. you can use classes more than once. minimize ids and classes over using the cascade and natural html elements. e.g. #myContent header ul versus #myContent .myHeader .mylist name your ids and classes semantically to describe what they are not their properties. e.g. header-logo not orange-header-logo be consistent in your naming formats using spaces, underscores, dashes, etc. don't use spaces or special characters in your ids or classes. stick with either a dash, camelcase or underscore. e.g. my-Content, my_content, myContent indent sub areas for easier viewing and reading make all your tags uppercase or lowercase, not both. Choose DIV or div. use comments when the intention is unclear put comments in front of or behind ending div, span or section elements with their class or id name. use unordered lists for navigation use basic ARIA roles to identify main bits of content use unordered lists for navigation use basic ARIA roles to identify main bits of content use respond.js or other shivs to let legacy browsers utilize basic HTML 5 elements like header, section, article, footer, nav and aside use no more than one H1 in a page unless nested in an HTML5 section, header, article or footer element. This can still confuse the DOM outline and is best with article syndicated content Articles are for syndication. Sections are general content areas (this is still vague). Asides are supposed to be for supporting content but are often used in sidebars. Everything should be enclosed in some sort of tag. p tags are good for text. structure and nest your headings logically Leave a Comment Cancel ReplyYou must be logged in to post a comment.
Leave a Comment
You must be logged in to post a comment.