The HTML 5 language has a "custom" HTML syntax that is compatible with HTML 4 and XHTML1 documents published on the Web, but is not compatible with the more esoteric SGML features of HTML 4.
HTML 5 does not he the same syntax rules as XHTML where we needed lower case tag names, quoting our attributes, an attribute had to he a value and to close all empty elements.
HTML5 comes with a lot of flexibility and it supports the following features −
Uppercase tag names. Quotes are optional for attributes. Attribute values are optional. Closing empty elements are optional. The DOCTYPEDOCTYPEs in older versions of HTML were longer because the HTML language was SGML based and therefore required a reference to a DTD.
HTML 5 authors would use simple syntax to specify DOCTYPE as follows −
The above syntax is case-insensitive.
Character EncodingHTML 5 authors can use simple syntax to specify Character Encoding as follows −
The above syntax is case-insensitive.
The tagIt's common practice to add a type attribute with a value of "text/jascript" to script elements as follows −
HTML 5 removes extra information required and you can use simply following syntax −
The tagSo far you were writing as follows −
HTML 5 removes extra information required and you can simply use the following syntax −
HTML5 ElementsHTML5 elements are marked up using start tags and end tags. Tags are delimited using angle brackets with the tag name in between.
The difference between start tags and end tags is that the latter includes a slash before the tag name.
Following is the example of an HTML5 element −
...
HTML5 tag names are case insensitive and may be written in all uppercase or mixed case, although the most common convention is to stick with lowercase.
Most of the elements contain some content like
...
contains a paragraph. Some elements, however, are forbidden from containing any content at all and these are known as void elements. For example, br, hr, link, meta, etc.Here is a complete list of HTML5 Elements.
HTML5 AttributesElements may contain attributes that are used to set various properties of an element.
Some attributes are defined globally and can be used on any element, while others are defined for specific elements only. All attributes he a name and a value and look like as shown below in the example.
Following is the example of an HTML5 attribute which illustrates how to mark up a div element with an attribute named class using a value of "example" −
...Attributes may only be specified within start tags and must never be used in end tags.
HTML5 attributes are case insensitive and may be written in all uppercase or mixed case, although the most common convention is to stick with lowercase.
Here is a complete list of HTML5 Attributes.
HTML5 DocumentThe following tags he been introduced for better structure −
section − This tag represents a generic document or application section. It can be used together with h1-h6 to indicate the document structure.
article − This tag represents an independent piece of content of a document, such as a blog entry or newspaper article.
aside − This tag represents a piece of content that is only slightly related to the rest of the page.
header − This tag represents the header of a section.
footer − This tag represents a footer for a section and can contain information about the author, copyright information, et cetera.
n − This tag represents a section of the document intended for nigation.
dialog − This tag can be used to mark up a conversation.
figure − This tag can be used to associate a caption together with some embedded content, such as a graphic or video.
The markup for an HTML 5 document would look like the following −
... ... ... ... ... ... ... HTML5 Document Structure ExampleThis page should be tried in safari, chrome or Mozila.
HTML Tutorial CSS Tutorial JaScript TutorialOnce article can he multiple sections
This is aside part of the web page
Created by Tutorials Point
It will produce the following result −
Print Page Previous Next Advertisements