HTML5 – K.I.S.S

There are a lot of changes from the HTML 4+ specifications to HTML5. The syntax rules are more forgiving and essentially, a lot of things are made simpler for programmers.

Doctype

<!DOCTYPE html>

Meta Character Encoding

<meta charset="UTF-8">

Syntax and Validation – W3C Validator

  • No need for type= “text/javascript” and type = “text/css” for <script> and <css> tags respectively
  • HTML tags may be written in any letter case
  • <html>, <body> and <head> tags not necessary for validation
  • <br />, <img /> no longer need self-closing slash
  • Most tags so not need closing tag.
  • Quotations around attributes are optional
  • Attributes with empty value may be written as just attribute name without “=” and the value

Use linter tools to check for stylistic errors. Write tags and attributes using lowercase. Use quotations around attribute values. Do not omit tags.

Problematic Elements

  • <basefont> removed
  • <big> removed
  • <center> removed
  • <font> removed
  • <strike> removed
  • <tt>removed
  • <frame> bad
  • <frameset> bad
  • <noframes> bad
  • <acronym> rare
  • <applet> rare
  • <dir> rare
  • <isindex> rare
  • <blink> obsolete

Just because elements are removed from the specifications doesn’t mean browsers will not render them. The concept of deprecation is no longer applicable. Now it’s simply features and obsolete features.