A simple markup standard for HTML5

Here is a simple HTML5 coding standard:

  • Always add a lang attribute on html element, e.g.: <html lang=”en-US”>
  • No self close empty tags anymore, e.g.: wirte <br> instead of <br />
  • No style attribute for rel links for css or in the <script> tags, e.g.:
    Just <link media=”all” href=”_css/style.css” rel=”stylesheet”>
    or <script src=”_js/calendar.js”></script>
  • Make all tags in lowercase
  • Use double quotes for attribute value
  • Jusrt write the attribute indicate instead of the value and the attribute for boolean attributes, e.g.:
    <section hidden>xxx</section> instead of <section hidden=”hidden”>xxx</section>

What do you think? :)

2 Comments - Leave a comment
  1. Mims Wright says:

    I know HTML coding standards is a very hot topic these days and it’s fair to say that there is no right way to do it. Frustratingly, there is no right way because HTML5 allows for so much flexibility. I personally prefer the old way of doing things, not because I like righting self-close slashes or extra attribute values, but because it adds a technical benefit of being compatible with XML and sometimes HTML4.

    Also, I find it ironic that right after you say not to use self-closing tags you show an example of a tag which requires self closing. It’s not really your fault, just an example of how kooky the syntax has become. : )

    Other than that, looks good!

  2. David Adam says:

    Ahah, thanks for the comment. Did you mean the tag “
    ” which requires self closing? Yeah, I myself actually also prefer the xhtml style that requires close tag correctly. HTML5 seems loosened many rules in xhmtl ( and went back to html4 ), I just don’t know if there will be a more restrict way for browsers to validate HTML5 syntax; I hope there will.

Leave a Reply

Your email address will not be published. Required fields are marked *

*