search

HTML5 Tags

Sep 04, 2024 pm 04:36 PM
htmlhtml5HTML TutorialHTML PropertiesHTML tags

We all know the standard abbreviation of HTML, which is HyperText Markup Language. So, HTML5 is the latest and the new version of HTML. Once a product is developed; obviously, there would be many versions of HTML with many new developments along the way. So, HTML5 has new attributes and behaviors. This HTML5 tag is not a programming language anymore, but it is a mark-up language. Now, what is a mark-up language? Defining elements attributes using tags in a document is a Mark-up language. Now, let’s get into detail about how we can define tags and create a web page.

Tags of HTML5

A tag is a specification for displaying content. Generally, there would be a start and end tag. Also, few tags do not require an end tag, like , which means breaking of the line, which displays the data next to that tag from the next line. Here, let’s see some of the new elements in HTML5.

In HTML5, we can generally divide the tags into two categories.

  • Semantic Elements: Few examples for these elements are;
    , ,
  • Non Semantic Elements: Examples here are;
    , etc.

    The tags discussed below are those which are newly introduced exclusively in HTML5 versions. They are different types of tags that all can be categorized.

    1. Structural Tags

    Below are the types of structural tag with examples:

    a. Article: This is a tag that is mostly used similar to a head tag. Majorly used in forms, blogs, news story and all as examples.

    Code:

    <article> <h3 id="The-first-one">The first one </h3></article>
    
    <h2>Welcome Back
    
    </h2>

    Output:

    HTML5 Tags

    b. Aside: Something similar to our normal tags, which would relate the content to the surrounding contents, like a sidebar in the article. And this tag would only make sense when using an IE version above 8.

    c. Details: This tag is used to provide some additional data to the user. This can be an interactive platform that can hide or show the details. We can get to see the usage of this tab under the summary tag.

    d. Header: This tag is related to the header part and contains title information. It has to have both the start and end tags.

    Code:

    <header>
    <h1 id="Happy-Hours">Happy Hours</h1>
    <nav>
    <p><a href="#">Morning</a> | <a href="#">Afternoon</a> | <a href="#">Evening</a></p>
    </nav>
    </header>
    

    Output:

    HTML5 Tags

    e. hgroup: This tag is used in describing a group of headers. Let’s look at the example.

    Code:

    
    <hgroup>
    <h1 id="Let-s-check-size-of-this-h">Let’s check size of this h1 </h1>
    <h2 id="Let-s-check-size-of-this-h"> Let’s check size of this h2 </h2>
    <h3 id="Let-s-check-size-of-this-h"> Let’s check size of this h3</h3>
    <h4 id="Let-s-check-size-of-this-h"> Let’s check size of this h4</h4>
    <h5 id="Let-s-check-size-of-this-h"> Let’s check size of this h5</h5>
    </hgroup>
    
    

    Output:

    HTML5 Tags

    f. Footer: This tag is that, which is to be placed at the end of the page. It deals with something like copyright, history-related information or data. Let us see a small example below.

    Code:

    
    <footer>
    <nav>
    <p><a href="#">Copy Rights</a> | <a href="#">Come back soon</a></p>
    </nav>
    <p>Please subsribe for more learning content</p>
    </footer>
    
    

    Output:

    HTML5 Tags

    g. nav: This tag is for providing a section of all the links for navigation.

    Code:

    
    <nav>
    <ul>
    <li><a href="https://www.educba.com/">EDUCBA Home</a></li>
    <li><a href="https://www.educba.com/about-us/">About EDUCBA</a></li>
    <li><a href="https://www.educba.com/courses/">Courses in EDUCBA</a></li>
    </ul>
    </nav>
    
    

    Output:

    HTML5 Tags

    Check by clicking on the links once you write your code while practicing.

    h. Section: As the name already denotes, this tag defines the part of the code like the body, header, footer, etc. Here, both the start and end tags are necessary. Let us see a small example below:

    Code:

    <section>
    <h1 id="Welcome"> Welcome </h1>
    <h4 id="See-you-soon"> See you soon </h4>
    <p>Thank You.</p>
    </section>
    

    Output:

    HTML5 Tags

    i. Summary: This tag is used in parallel with the details tab. Under the details tag, we have this summary tag to summarize the concepts. Example below:

    Code:

    
    <details>
    <summary>How is this Summary tag defined?</summary>
    <p>By clicking the arrow beside the Summary question I got displayed</p>
    </details>
    <p> The data after the display tag is displayed like this.</p>
    
    

    Output:

    HTML5 Tags

    Now expanding the summary tag data, we get the below.

    HTML5 Tags

    2. Form Tags

    Here are the different types of form tag explained below with examples:

    a. Datalist: This tag is used like a drop-down that has pre-defined values for a user to choose. Let us have a look at the small example below:

    Code:

    
    <p>Enter your favorite browser name:</p>
    <input type="text" list="browsers">
    <datalist id="browsers">
    <option value="Firefox">
    </option>
    <option value="Chrome">
    </option>
    <option value="Internet Explorer">
    </option>
    <option value="Opera">
    </option>
    <option value="Safari">
    </option></datalist>
    
    

    Output:

    HTML5 Tags

    The drop-down pops up when the mouse has hovered over.

    HTML5 Tags

    b. Keygen: This is for the encryption. It is for generating an encrypted key for passing the data in an encrypted format. Only the start tag is enough/required for this element, and the end tag is not mandatory.

    c. Meter: This tag would give us the measurement of the data which is present in a given range.

    Code:

    
    <meter value="25" min="0" max="100">25 out of 100</meter><p> This is 25 out of 100 </p><br>
    <meter value="0.7">70%</meter><p> This is the range for 70%</p>
    
    

    Output:

    HTML5 Tags

    3. Formatting Tags

    Below are the types of formatting tag with examples:

    a. BDI: This is Bi-directional isolation. As the name already suggests, this tag can be used to isolate a part of the text and give it different styles from that of other text.

    b. Mark: This tag can help us highlight a specific text.

    Code:

    
    <p>This is how you can <mark>mark or highlight</mark> a text.</p>
    
    

    Output:

    HTML5 Tags

    c. Output: As the name already shows us, it gives the result of any calculation.

    Code:

    
    
    =

    Output:

    HTML5 Tags

    Make sure that you notice the form attribute of oninput. Once you input the attribute ‘x’ value, then the output gets displayed.

    d. Progress: This tag gives us the progress of a particular task.

    Code:

    
    <progress value="80" max="100"></progress><p> This progress bar is 80% completed</p>
    
    

    Output:

    HTML5 Tags

    e. Rp: This is used when the ruby tags are not supported.

    f. Rt: It is used with the tag ruby. Mostly this is used in pronunciation in both Japanese and Chinese languages.

    g. Ruby: This tag is used with the rt and rp tags where the annotations with respect to the two languages, Chinese and Japanese, are pronounced.

    h. Wbr: This tag is for the word break. It is mainly used to check how a word breaks when the window size is resized.

    4. Embedded Content Tags

    Here are the types of embedded content tag explained below with examples:

    a. Audio: As the name already suggests, this tag would help us to incorporate audio files in the HTML document.

    b. Canvas: Defines a place on the web page where graphics or shapes, or graphs are present or can be defined. Here is an example.

    Code:

    
    <canvas id="run"></canvas>
    <script type="text/javascript">
    window.onload = function(){
    var can = document.getElementById("run");
    var context = can.getContext("2d");
    context.moveTo(30, 60);
    context.lineTo(150, 30);
    context.stroke();
    };
    </script>
    
    

    Output:

    HTML5 Tags

    c. Dialog: This tag gives us a default box, especially if we wanted to have data in a box.

    Code:

    
    <p> Trying dialog here <dialog open>How does dialog box come up?</dialog> </p>
    
    

    Output:

    HTML5 Tags

    d. Embed: This tag can be used for getting in any external file to the HTML file. We can have only the start tag, and the end tag is not mandatory here. There are different attributes that can be used with this tag, namely, width, height, src, and type.

    e. Figure and Figcaption: This, as already in its name, can incorporate the images and can give a caption to that image.

    f. Source: This tag can implement multiple audio and video files by providing the location of the files using this source tag.

    g. Time: This tag, as the name already notifies, is a tag for displaying the time. And note that this tag is not functional in the cases of internet explorer version 8 and below.

    h. Video: With the name of the tag, we can obviously get to know where this tag is used. For specifying the video files, we have this tag. Inside this Audio/Video tags, we define the source tags in specifying the files and their locations.

    Input Elements of HTML5 Tags

    Here are some input elements which we are using in HTML5 tags:

    1. Email: This is one of the input elements in HTML5. This element takes in only email addresses as the input.

    2. Number: This input element only accepts the number.

    3. Range: As the name already explains, this tag contains a range of numbers.

    4. URL: This input tag accepts the input field for the URL address. In this input type, we can only enter the URL.

    5. Placeholder: This is one of the attributes for the input type as text or text area or any number. This place holder value shows the value to be given as the input.

    Code:

    
    Enter Date of birth : <input type="text" name="dob" placeholder="dd/mm/yyyy">
    
    

    Output:

    HTML5 Tags

    6. Autofocus: This attribute automatically focuses on a particular field where this element has been declared inside the input tag. This attribute is supported only by the latest versions of Chrome, Safari, and Mozilla only. The syntax is like this:

    <input type="“textarea”" name="”focus”" autofocus>
    Tag 
    : This tag represents a description of a definition. Tag : This tag deletes a specified text. Tag : This tag helps to display data in a scrolling manner. This texxt is in a scrolling manner

    Output:

    HTML5 Tags

    7. : This is one of the basic tags that would help the browser understand the HTML version in which the program is being written. The declaration of this tag is to be written before the HTML tag.

    8. : This Meta tag describes the description of the HTML document. It contains the author’s name, date, and modifications, etc.

    In this HTML5, we even have an opportunity to get the GeoLocation of a device. There are different methods that can be helpful in making this location tagging easy. There are also different fonts and colors available in HTML5. Below are the few tags that are removed from the HTML usage from this HTML5 version.

    Acronym, Applet, big, dir, font, frameset, center, tt (TeleType text), basefont, center, strike, frame, u (underlined text), isindex, noframes, etc. Few attributes that are removed are below:

    Align, bgcolor, cellpadding, cellspacing, border, link, shape, charset, archive, codebase, scope, alink, vlink, link, background, border, clear, scrolling, size, width, etc.

    9. This tag is used to display the content where the use of JavaScript is disabled. Any content written inside this tag can be used in place of the content wherever javascript is used. As an exercise, can you try executing the different tags for which examples are not provided?

    Conclusion

    So, yes, there are the basic tags and references for HTML5. The initial version of HTML5 was released on 28th October 2014. We have seen different new tags that were introduced and had gone through a few attributes in HTML5. In the end, we had even covered that not only the introduction of new elements was done, but some elements and attributes that were present were restricted from use through this new release of HTML5.

    There were many attributes that were given with examples and some with only the data and the purpose of the attribute or elements. Try practicing all those different elements and attributes and keep learning.

The above is the detailed content of HTML5 Tags. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
HTML as a Markup Language: Its Function and PurposeHTML as a Markup Language: Its Function and PurposeApr 22, 2025 am 12:02 AM

The function of HTML is to define the structure and content of a web page, and its purpose is to provide a standardized way to display information. 1) HTML organizes various parts of the web page through tags and attributes, such as titles and paragraphs. 2) It supports the separation of content and performance and improves maintenance efficiency. 3) HTML is extensible, allowing custom tags to enhance SEO.

The Future of HTML, CSS, and JavaScript: Web Development TrendsThe Future of HTML, CSS, and JavaScript: Web Development TrendsApr 19, 2025 am 12:02 AM

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

HTML: The Structure, CSS: The Style, JavaScript: The BehaviorHTML: The Structure, CSS: The Style, JavaScript: The BehaviorApr 18, 2025 am 12:09 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The Future of HTML: Evolution and Trends in Web DesignThe Future of HTML: Evolution and Trends in Web DesignApr 17, 2025 am 12:12 AM

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

HTML vs. CSS vs. JavaScript: A Comparative OverviewHTML vs. CSS vs. JavaScript: A Comparative OverviewApr 16, 2025 am 12:04 AM

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTML: Is It a Programming Language or Something Else?HTML: Is It a Programming Language or Something Else?Apr 15, 2025 am 12:13 AM

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML: Building the Structure of Web PagesHTML: Building the Structure of Web PagesApr 14, 2025 am 12:14 AM

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

From Text to Websites: The Power of HTMLFrom Text to Websites: The Power of HTMLApr 13, 2025 am 12:07 AM

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software