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

Current affairs

Narendra Ambwani elected as chairman of the Advertising Standards Council of India (ASC Published on: 13-SEP-2014 Important for Exam:  6 people agreed Narendra Ambwani on 12 September 2014 elected as Chairman of the Advertising Standards Council of India (ASCI). SBI celebrated 150 years of its operations in Sri Lanka Published on: 13-SEP-2014 Important for Exam:  6 people agreed State Bank of India (SBI) on 13 September 2014 celebrated 150 years of its operations in Sri Lanka. West Bengal cabinet cleared farmer-friendly project Sech-Bandhu Prakalpa to boost irrigation Published on: 13-SEP-2014 Important for Exam:  8 people agreed The West Bengal cabinet on 12 September 2014 cleared a farmer-friendly project named  Sech-Bandhu Prakalpa  to boost irrigation. Delhi Government to charge cess of one rupee on cigarette and liquor to promote public tra Published on: 13-SEP-2014 Important for Exam:  5 people agreed ...

📍 DIFFERENCE BETWEEN FDI and FPI

  DIFFERENCE BETWEEN FDI and FPI #Stockmarket 💡 FDI is involved in setting up firms to produce goods and services. That is why it is called 'direct' institution. FPI on the other hand buys financial assets for profits. In order to remove the ambiguity that prevails on what is Foreign Direct Investment (FDI) and what is Foreign Institutional Investment (FII), it was decided to follow the international practice and lay down a broad principle that, where an investor has a stake of 10 percent or less in a company, it will be treated as FII and, where an investor has a stake of more than 10 percent, it will be treated as FDI. 💡 Since the source of funds is not revealed, the PNs are potentially unsafe. Therefore, SEBI imposed certain conditions like limits on the PNs that a single FII can issue, etc. SEBI wants the PN holders to register with SEBI and invest directly as India is a long-term growth story. SEBI policy paid off with the number of FIIs registering with the regulator go...

■ Can India Become A Technology Leader? India

  ■ Can India Become A Technology Leader?   ✅India is presently not a major player in the field of technology due to certain challenges and on the other side, there are many celebrated Indian technologists around the world as many of the technology giants choose an India- born techie as their leader. ✅The conversation around Indian executives at the helm of top tech companies has gathered some momentum with Parag Agrawal taking over as Twitter CEO. The major technology companies like Google and its parent company Alphabet, Microsoft and Twitter, Adobe and IBM are all headed by Indians. ● The Case of the U.S: ✅The Indian immigrants in the U.S are the part of the most educated and professionally accomplished communities in that country. ✅As of 2019, there were 2.7 million Indian immigrants in the U.S. ✅The government of the U.S has been instrumental in the triumphs of enterprise and the free market. ✅The governmental agencies have been actively supporting the research and develo...

World famous event

1. Walmart to open new store in India after 2-year gap  i. After a gap of two years, US retail major Walmart will open a new cash and carry store in Agra as it returns focus on India.  ii. The company, which opened its last store in Bhopal towards the end of 2012, has said it will focus on cash and carry business in India in the absence of clarity on FDI in multi-brand retail trade. iii. "Walmart is committed to India and we are focused on our growth plans... We have recently received all internal approvals for opening a new store in Agra, our second one in the city," Walmart spokesperson told PTI. 2. Jyotsna Suri elected as the President of the FICCI i. Jyotsna Suri, Chairperson of Bharat Hotels, on 20 December 2014 was elected as the President of the Federation of Indian Chambers of Commerce & Industry (FICCI). ii. Suri succeeded Sidharth Birla. iii. Alok B Shriram, deputy managing director of DCM Shriram Industries Ltd, assumed the charge of the presid...

Serial Blasts In SRI LANKA

Serial blasts across Sri Lanka Mains-GS-3-Security 1. Over 200 people were killed and nearly 500 injured in a series of blasts that shook Sri Lanka on Easter Sunday. 2. Churches and luxury hotels were targeted in the deadliest incidents since the civil war ended a decade ago. 3. Eight blasts occurred in and around the capital Colombo and in the eastern city of Batticaloa when large groups gathered at churches for Easter services. 4. Most of the blasts appear to have been suicide bombings. No group has claimed responsibility for the blasts. 5. Investigating authorities in Sri Lanka are yet to disclose the names of the suspects or the alleged perpetrators. 6. The scale and savagery of the attacks that clearly targeted Christians have left Sri Lankans devastated. Curb on Social Media 1. Sri Lankan law enforcement have urged the public to stay indoors following series of blasts. 2. Sri Lankan government blocked social media platforms like Facebook and Instagram to prevent the sp...

Follow the Page for Daily Updates!