Welcome Guest! (App Version 3.1)

websitnero logo name

Syntax Changes


  • <doctype> declaration is now short and simple.
  • In <script> tags, type attribute is optional now.
  • Attribute values in elements may not have quotes around them, while still wrapping values with quotes is a good habit.

1. Doctype Declaration

The doctype declaration tells the web browser what version of HTML rules are to be followed while rendering the current web page. Earlier, the doctype declaration was quite complex but it has been simplified in the current version of HTML.

Following are the doctype declarations along with the HTML versions:

Doctype Declarations
HTML VersionRepresentation
HTML 4.01 Strict<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
HTML 4.01 Transitional<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd>
HTML 4.01 Frameset<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd>
XHTML 4.01 Strict<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
XHTML 1.1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd>
XHTML 1.0 Transitional<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>
XHTML 1.0 Frameset<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd>

2. No Type Required (link and script tags)

Earlier script tags were required to tell what kind of script it had enclosed within tags but now with HTML5 script tags do not require type attribute to be included. Similar is the case with the link tag while including CSS style sheets.

Following table shows the attribute changes in HTML5 with the removal of type attribute:

Script Tags without Type Attribute
HTML VersionRepresentation
HTML 5<script src="path/to/script.js"></script>
HTML 4.01<script type="text/javascript" src="path/to/script.js"></script>
Link Tags without Type Attribute
HTML VersionRepresentation
HTML 5<link rel="stylesheet" href="path/to/stylesheet.css">
HTML 4.01<link rel="stylesheet" href="path/to/stylesheet.css" type="text/css" >

3.To Quote or Not to Quote

Till HTML 4.01, it was necessary to put the values for various attributes in quotes, but with HTML5 this is optional. Though, for good habit of clean coding we suggest keep putting double quotes while putting values for various attributes.

Following example shows the two code snippets with and without quotes for attribute values:

To Quote or Not To Quote
HTML VersionRepresentation
HTML 5<p class=class1 id=id1> This is a paragraph.</p>
HTML 4.01 Strict<p class="class1" id=s"id1"> This is a paragraph.</p>
WebsiteNero is highly optimized for learning various website developing technlogies. We try our best to add maximum modules and examples to help learn the concepts clearly and vividly. We try to present all content and examples as simple as we can removing any complexity to hurdle easy understanding. We try best provide you with worthful content, but we cannot guarantee full correctness of all the content on this site. While using this website, you agree to have read and accepted all our terms of use and conditions, cookie, and privacy policy. Copyright, 2013-2018 by websitenero.com. All Rights Reserved.