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

India & Russia Relation

1.  India expects Russia to be more involved in the Indo-Pacific and to look to its own interests in the region. 2. This will create a mutual basis for cooperation and dialogue. 3. Investments in Vietnam’s oil and gas sector is seen as one of the areas of cooperation as both India and Russia have planned to invest in this sector. 4. India also sees Russia as a very important Pacific power 5. Russia has an interest in the Indian Ocean and India has an interest in the Pacific Ocean. 6. As, Indo-Pacific is seen as a geographic continuum for cooperation and for certain principles, India wants Indo-Pacific region to be free and fair for everyone. 7. Russia views its engagement would create new divisions especially with respect to containment of China. 8. On the other hand, India neither views it as containment nor non-containment but as a positive construct that brings together countries on the basis of certain principles. South China sea 1. A stable Indo-Pacific assumes particular impo...

SSC WORD

1. TRANQUILITY : शांति Meaning:  a peaceful, calm state, without noise, violence, worry, etc. Synonyms:  calmness, coolness Antonyms:  chaos, loudness Example:  Not surprisingly, the desire for tranquility among local inhabitants is almost palpable. 2. REBOUND : वापस आना Meaning:  If an action rebounds on you, it does not have the effect you hoped for but has an unpleasant effect on you instead Synonyms:  recoil, recuperate Antonyms:  weaken, hurt Example:  His continual demands for sympathy rebounded on him because his friends finally stopped listening. 3. INVIGORATE : प्रोत्साहन Meaning:  to give new energy or strength to someone or something Synonyms:  boost, stimulate Antonyms:  discourage, dissuade Example:  They argued that a cut in the tax rate would invigorate the ec...

UPSC

&#128204;PERIOD POVERTY Scotland may become the first country in the world to end ‘period poverty’ by making sanitary products free for all. About: • The Scottish Parliament passed the Period Products (Free Provision) (Scotland) Bill. • Referring to “period dignity”, the legislation aims to develop a universal system in Scotland, which will provide free sanitary products for “anyone who needs them”. • As of now, in Scotland, the provision of free sanitary products is already available in schools, universities and colleges. • The Bill has only passed the first hurdle to become a law. It still needs to be considered by a parliamentary committee, following which it will require approval from the parliament. It will finally need the Royal Assent of the Queen.  ▪️Important Info : What is ‘period poverty’? Some circumstances make menstruation a “difficult experience” for women. T...

Apple is testing a ChatGPT-like AI chatbot

  According to a recent report by Bloomberg's Mark Gurman, Apple is making significant strides in the development of artificial intelligence tools to rival the likes of OpenAI and Google. Internally referred to as "Apple GPT," the tech giant has created a chatbot using its proprietary framework called "Ajax." This framework, built on Google Cloud with Google JAX, enables the creation of large language models similar to ChatGPT and Google's Bard. While Apple is yet to finalize its strategy for consumer release, it is reportedly planning a major AI-related announcement next year. The chatbot's internal rollout faced delays due to security concerns related to generative AI. However, it has been made available to a growing number of Apple employees with special approval, primarily for product prototyping purposes. Apple's chatbot can summarize text and answer questions based on its training data. Although it shares similarities with commercially availabl...

जम्मू और कश्मीर में सुरंगें Tunnels in Jammu & Kashmir

जम्मू और कश्मीर में सुरंगें Tunnels in Jammu & Kashmir केंद्रीय सड़क परिवहन और राजमार्ग मंत्री विभिन्न राष्ट्रीय राजमार्ग (National Highway- NH) परियोजनाओं की आधारशिला रखेंगे तथा केंद्रशासित प्रदेश जम्मू एवं कश्मीर में जेड-मोड़  (Z-Morh)  तथा जोजिला सुरंग ( Zojila Tunnel)  की समीक्षा एवं निरीक्षण करेंगे। प्रमुख बिंदु श्यामा प्रसाद मुखर्जी सुरंग:  चेनानी-नाशरी सुरंग (Chenani-Nashri Tunnel) का नाम बदलकर श्यामा प्रसाद मुखर्जी सुरंग (Shyama Prasad Mukherjee Tunnel) कर दिया गया है। यह न केवल भारत की सबसे लंबी राजमार्ग सुरंग (9 किमी. लंबी) है बल्कि एशिया की सबसे लंबी द्वि-दिशात्मक राजमार्ग सुरंग (Bi-directional Highway Tunnel) भी है।  यह जम्मू एवं कश्मीर में उधमपुर तथा रामबन के मध्य निम्न हिमालय पर्वत शृंखला में स्थित है। बनिहाल काज़ीगुंड सुरंग:  यह बनिहाल और काज़ीगुंड को जोड़ने वाले जम्मू एवं कश्मीर केंद्रशासित प्रदेश में पीर पंजाल रेंज में 1,790 मीटर की ऊंँचाई पर स्थित 8.5 किमी. लंबी सड़क सुरंग (Road Tunnel) है। जवाहर सुरंग:  इसे बनिहाल सुरंग (Banihal Tu...

Follow the Page for Daily Updates!