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

Most Important Topics. International , Science , UPSC, BPSC..

  International Relations Prev First in-Person Meeting of Quad Countries           Star marking (1-5) indicates the importance of topic for CSE Tags:  GS Paper - 2 Groupings & Agreements Involving India and/or Affecting India's Interests Why in News Recently, the first in-person meeting of  Quad  leaders was hosted by the US. Issues like climate change, Covid-19 pandemic and challenges in the Indo Pacific, amidst China's growing military presence in the strategic region, were discussed in the meeting. Key Points Background: In  November 2017, India, Japan, the US and Australia gave shape to the long-pending proposal of setting up the Quad  to develop a new strategy to keep the critical sea routes in the Indo-Pacific free of any influence. China claims nearly all of the disputed  South China Sea , though Taiwan, the Philippines, Brunei, Malaysia and Vietnam all claim parts of it. The South China Sea is an arm of the Western ...

### 🧠 Top 5 Artificial Intelligence News You Need to Know This Week

#### 1. Polish Language Leads in Complex AI Tasks A new global study has revealed that the Polish language outperformed all others, including English, in handling complex AI tasks. This finding highlights that artificial intelligence systems are becoming increasingly capable of understanding less commonly used languages. It also emphasizes the growing importance of developing AI tools that perform well across different linguistic and cultural contexts. #### 2. South Korea Pushes to Become a Global AI Powerhouse In a bold move to strengthen its AI ecosystem, South Korea has introduced tax relief measures for nearly 5,000 AI startups. The initiative aims to make the country one of the top three global AI leaders. This step not only encourages innovation but also shows how government policies can shape the future of artificial intelligence and emerging technologies. #### 3. AI Helps Police Solve Crimes Faster A police department in the United States has started using a new AI tool to anal...
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- srportalgiri_main_AdSense1_250x250_as --> <ins class="adsbygoogle"      style="display:inline-block;width:250px;height:250px"      data-ad-client="ca-pub-2060990885270177"      data-ad-slot="4129699440"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script>

UPSC MCQ

Consider the following statements: 1. Polavaram Project is a multi-purpose irrigation project. 2. It is a dam located across Krishna River. 3. The dam is located in Telangana state. Which of the above written statements is/are true? Choose the correct code from the options given below: A. 1 only B. 3 only C. 1 and 2 D. 2 and 3 Explanation : Polavaram Project is a dam located across Godavari River, located in Andhra Pradesh. It was accorded national project status as part of the legislation bifurcating Andhra Pradesh in 2014. Recently, the Ministry of Water Resources (MoWR), National Water Development Agency (NWDA) and National Bank for Agriculture and Rural Development (NABARD) signed a fresh Memorandum of Agreement (MOA) to provide for a total Rs 1,400 crore as part of the central share. Which of the following statements regarding military exercises is/are correct? 1. Coordinated Patrol (CORPAT) is bilateral naval exercise held between India and Indonesia. 2. Rim of ...

Oil report

The United Nations (UN) on 18 December 2014 sent a team of international experts to help Bangladesh in cleaning up the Sundarbans oil spill. The team belonging to the United Nations Disaster Assessment and Coordination (UNDAC) was sent on a request from Bangladesh government. The UN team will help Bangladesh government in the ground work and will also conduct an assessment and advise on recovery and risk reduction measures. The team comprises of experts from Britain, European Union, France and the United States. Besides, the UN asked Dhaka to impose a complete ban on the movement of commercial vessels through the Sundarbans.

Follow the Page for Daily Updates!