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

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...

How to earn money using ChatGPT !

  Content Creation and Writing: You can use AI language models to assist in content creation, such as writing articles, blog posts, or social media content. Some content creators use AI-generated drafts and then refine them with their own ideas and style. Language Translation Services: You can offer language translation services using AI language models to help with translating documents or text between different languages. Chatbot Development: If you have programming skills, you can integrate AI language models into chatbots for businesses or websites, helping them provide automated customer support. Tutoring and Educational Assistance: Use AI language models to create educational content, answer students' questions, or provide tutoring support in specific subjects. Copywriting and Marketing: Assist in generating marketing copy, ad content, or email campaigns using AI language models to improve efficiency and creativity. Writing and Publishing Books: Some authors use AI lang...

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...

Mobile hacking code.

               Hack Code. 1] *#0000# Displays Your Phones software version,Ist line: Software version, 2nd line: software release date,3rd line: compression type 2] *#9999# Phones softwares version if *#0000# does not work 3] *#06# For checking the international Mobile Equipment identity(IMEI number) 4] *#2640# Displays security Code in use 5] #pw+1234567890+1# Provides Lock Status(use the * button to obtain the "p,w,+" symbols for following codes)  6] #pw+1234567890+2# Network Lock Status(use the * button to obtain the "p,w,+" symbols for following codes)  7] #pw+1234567890+3# Country lock Status (use the * button to obtain the "p,w,+" symbols for following codes)  8] #pw+1234567890+4# SIM card Lock status(use the * button to obtain the "p,w,+" symbols for following codes) 9] *#21# Allows u to check the number that "All Calls" are diverted to 10] *#30# Lets u see the private number 11] *#43# Allows u to ch...

UPSC ARTICLE

๐Ÿ“š เคจिเคตेเคถเค•ों เค•ो เคจเคˆ เคคेเคฒ เคต เค—ैเคธ เคจीเคคि เคธे เคฒुเคญाเคจे เค•ी เค•ोเคถिเคถ เคธเคฐเค•ाเคฐ เคจे เคคेเคฒ เคเคตं เค—ैเคธ เค–ोเคœ เค•्เคทेเคค्เคฐ เคฎें เคจिเคœी เค”เคฐ เคตिเคฆेเคถी เคจिเคตेเคถ เค†เค•เคฐ्เคทिเคค เค•เคฐเคจे เค•े เคฒिเค เค‡เคธเคธे เคœुเคก़ी เคจीเคคि เคฎें เค…เคนเคฎ เคฌเคฆเคฒाเคต เค•िเค เคนैं। เคจเคˆ เคจीเคคि เค•े เคคเคนเคค เคธเคฐเค•ाเคฐ เคจเค เคเคตं เค•เคฎ เค–ोเคœे เค—เค เค•्เคทेเคค्เคฐों เคฎें เคนाเค‡เคก्เคฐोเค•ाเคฐ्เคฌเคจ เค‰เคค्เคชाเคฆเคจ เคชเคฐ เคธंเคฌंเคงिเคค เค•ंเคชเคจी เคธे เคฒाเคญ เคฎें เคนिเคธ्เคธा เคจเคนीं เคฎांเค—ेเค—ी। เคนเคฐ เคคเคฐเคน เค•े เคฌेเคธिเคจ เค•े เคฒिเค เคเค• เคธเคฎाเคจ เค…เคจुเคฌंเคง เคตाเคฒी เคฆो เคฆเคถเค• เคชुเคฐाเคจी เคจीเคคि เคฎें เคฌเคฆเคฒाเคต เค•เคฐเคคे เคนुเค เคจเคˆ เคจीเคคि เคฎें เค…เคฒเค—-เค…เคฒเค— เค•्เคทेเคค्เคฐों เค•े เคฒिเค เค…เคฒเค—-เค…เคฒเค— เคจिเคฏเคฎ เคฌเคจाเค เค—เค เคนैं। เค‡เคธเค•े เคคเคนเคค เคชเคนเคฒे เคธे เค‰เคค्เคชाเคฆเคจ เคตाเคฒे เค•्เคทेเคค्เคฐों เค”เคฐ เคจเค เค•्เคทेเคค्เคฐों เค•े เคฒिเค เคจिเคฏเคฎ เค…เคฒเค—-เค…เคฒเค— เคฐเคนेंเค—े। เค†เคงिเค•ाเคฐिเค• เค…เคงिเคธूเคšเคจा เค•े เค…เคจुเคธाเคฐ เค‰เคค्เคชाเคฆเค•ों เค•ो เคญเคตिเคท्เคฏ เคฎें เคฌोเคฒी เค•े เคฆौเคฐाเคจ เคคेเคฒ เคเคตं เค—ैเคธ เค•े เคฒिเค เคตिเคชเคฃเคจ เค”เคฐ เค•ीเคฎเคค (เคฎाเคฐ्เค•ेเคŸिंเค— เคंเคก เคช्เคฐाเค‡เคธिंเค—) เค•े เคฎाเคฎเคฒे เคฎें เค†เคœाเคฆी เคนोเค—ी। เค‡เคธ เคช्เคฐเค•्เคฐिเคฏा เคฎें เค‡เคธ เคฌाเคค เคธे เค•ोเคˆ เคช्เคฐเคญाเคต เคจเคนीं เคชเคก़ेเค—ा เค•ि เคฌेเคธिเคจ เค•ैเคธा เคนै। เค•ेंเคฆ्เคฐीเคฏ เคฎंเคค्เคฐिเคฎंเคกเคฒ เคจे 28 เคซเคฐเคตเคฐी เค•ो เคจिเคฏเคฎ เคฎें เคฌเคฆเคฒाเคต เค•ो เคฎंเคœूเคฐी เคฆी เคฅी। เค‡เคธเคฎें เค•เคนा เค—เคฏा เคนै เค•ि เคญเคตिเคท्เคฏ เคฎें เคธเคญी เคคेเคฒ เคเคตं เค—ैเคธ เค•्เคทेเคค्เคฐ เคฏा เคฌ्เคฒॉเค• เค•ा เค†เคตंเคŸเคจ เคช्เคฐाเคฅเคฎिเค• เคฐूเคช เคธे เค–ोเคœ เค•ाเคฐ्เคฏों เค•ो เคฒेเค•เคฐ เคœเคคाเคˆ เค—เคˆ เคช्เคฐเคคिเคฌเคฆ्เคงเคคा เค•े เค†เคงाเคฐ เคชเคฐ เค•िเคฏा เคœाเคเค—ा।เคจเค เคจिเคฏเคฎ เค•े เคคเคนเคค เค•ंเคชเคจिเคฏों เค•ो เคถ्เคฐेเคฃी-เคเค• ...

Follow the Page for Daily Updates!