Skip to main content

HTML5 syntax

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 have the same syntax rules as XHTML where we needed lower case tag names, quoting our attributes,an attribute had to have a value and to close all empty elements.
But HTML5 is coming with lots of flexibility and would support the followings:
  • Uppercase tag names.
  • Quotes are optional for attributes.
  • Attribute values are optional.
  • Closing empty elements are optional.

The DOCTYPE:

DOCTYPEs 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:
<!DOCTYPE html>
All the above syntax is case-insensitive.

Character Encoding:

HTML 5 authors can use simple syntax to specify Character Encoding as follows:
<meta charset="UTF-8">
All the above syntax is case-insensitive.

The <script> tag:

It's common practice to add a type attribute with a value of "text/javascript" to script elements as follows:
<script type="text/javascript" src="scriptfile.js"></script>
HTML 5 removes extra information required and you can use simply following syntax:
<script src="scriptfile.js"></script>

The <link> tag:

So far you were writing <link> as follows:
<link rel="stylesheet" type="text/css" href="stylefile.css">
HTML 5 removes extra information required and you can use simply following syntax:
<link rel="stylesheet" href="stylefile.css">

HTML5 Elements:

HTML5 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:
<p>...</p>
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 <p>...</p> 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 and meta etc.
Here is a complete list of HTML5 Elements.

HTML5 Attributes:

Elements 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 have a name and a value and look like as shown below in the example.
Following is the example of an HTML5 attributes which illustrates how to mark up a div element with an attribute named class using a value of "example":
<div class="example">...</div>
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 Document:

The following tags have 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.
  • nav: This tag represents a section of the document intended for navigation.
  • 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 HTM 5 document would look like the following:
<!DOCTYPE html>
<html>
<head>
   <meta charset="utf-8">
   <title>...</title>
</head>
<body>
  <header>...</header>
  <nav>...</nav>
  <article>
    <section>
      ...
    </section>
  </article>
  <aside>...</aside>
  <footer>...</footer>
</body>


Comments

Popular Post

Brief Introduction of Data Science !

  What is Data Science? Data science is a deep study of the massive amount of data, which involves extracting meaningful insights from raw, structured, and unstructured data that is processed using the scientific method, different technologies, and algorithms. It is a multidisciplinary field that uses tools and techniques to manipulate the data so that you can find something new and meaningful. Data science uses the most powerful hardware, programming systems, and most efficient algorithms to solve the data related problems. It is the future of artificial intelligence. In short, we can say that data science is all about: Asking the correct questions and analyzing the raw data. Modeling the data using various complex and efficient algorithms. Visualizing the data to get a better perspective. Understanding the data to make better decisions and finding the final result. Example: Let suppose we want to travel from station A to station B by car. Now, we need to take some decisions such ...

Some known Fact.

 

The Theory of Everything: National Highways

Iindia latest news .,Free hacking trick,upsc.

1. Kalyan Singh sworn in as Himachal Pradesh Governor i.  Rajasthan Governor Kalyan Singh was today sworn in as the Himachal Pradesh Governor  ii.  He was administered oath of office by Himachal Pradesh High Court Chief Justice Mansoor Ahmed Mir  iii.  Singh has been given an additional charge of Himachal Pradesh after Urmila Singh, who completed the full five year term as HP Governor on January 24.   2.  Hockey Olympian Jaswant Singh Rajput passes away i.  Two-time gold medal winning hockey Olympian Jaswant Singh Rajput passed away on 28th January 2015 following a prolonged illness ii.  The former India centre-half was part of the gold medal winning teams in 1948 London and 1952 Helsinki Olympics. iii.  With the likes of Leslie Claudius, Keshav Dutt and Meldric Daluz, Jaswant had formed a lethal foursome and was part of a golden era in Bengal hockey with as many as seven players in the Helsinki-bound side.   3....

K.K Paul to be governor.

1. K.K. Paul to be Uttarakhand Governor i.  Krishan Kant Paul will be sworn in as the sixth Governor of Uttarakhand on January 8. ii.  A presidential communiqué said Mr. Paul, Meghalaya Governor, would continue to hold the office of the Governor of Manipur. iii.  The current Uttarakhand Governor, Aziz Qureshi, would be transferred to Mizoram. iv.  Challenging the move of the Narendra Modi government to seek resignations of Governors appointed during the UPA regime.   2. Uttarakhand governor Aziz Qureshi transferred to Mizoram i.  Dr Aziz Qureshi was shunted out and appointed Mizoram governor.  ii.  A statement issued by the President's office said that Qureshi had been given charge of Mizoram for the remainder of his term. He has almost three years of tenure left.  iii.  West Bengal governor K N Tripathi meanwhile has been asked to take additional charge of Meghalaya.  3. Pakistani fishing boat carrying explosi...

Follow the Page for Daily Updates!