By the end of this lesson you should be able to:
Semantic HTML gives meaning to your web content. Rather than just using a generic <div> tag, semantic tags like <header>, <article>, and <footer> .give descriptive meaning to each section on the page.
Forms are what users will use to interact with your web application, whether that is to sign up, log in, search or submit data. Hence, knowing how to create a form correctly is a necessary skill for every web developer.
Semantic HTML tags are tags that indicate the purpose of content which allows for better accessibility, SEO, and clearer code
Common Semantic Tags:
Example:
<header>
<h1>Welcome to My Blog</h1>
</header>
<main>
<article>
<h2>HTML Basics</h2>
<p>HTML stands for HyperText Markup Language.</p>
</article>
</main>
<footer>
<p>© 2025 My Blog</p>
</footer>
Tip: Using semantic elements is valuable for screen reader and search engine optimization of your page.
Quick Recap — Semantic HTML
A form is an HTML component that gives users a way to enter data and submit it to a server or process it on the client-side.
Basic Structure of a Form:
<form action='submit.html' method='post'>
<label for='name'>Name:</label>
<input type='text' id='name' name='name'>
<input type='submit' value='Submit'>
</form>
Tip: The ‘action’ indicates where the form data is sent and the ‘method’ indicates how (GET or POST) it is sent.
Different input types are available for your form, each which accepts its own type of data from the user.
Common Input Types:
• text – for single-line input
• email – for email addresses
• password – hides input with dots
• checkbox – for yes/no options
• radio – for multiple-choice options
• submit – to submit the data in the form
Common Attributes:
• placeholder – hint provided inside the input box
• required – makes a field mandatory
• name – assigns a name to the field
• value – defines a default value
Example:
<form action='#' method='post'>
<label for='name'>Full Name:</label><br>
<input type='text' id='name' name='name' placeholder='Enter your name' required><br><br>
<label for='email'>Email:</label><br>
<input type='email' id='email' name='email' placeholder='Enter your email' required><br><br>
<label for='password'>Password:</label><br>
<input type='password' id='password' name='password' placeholder='Enter password' required><br><br>
<label>Gender:</label><br>
<input type='radio' name='gender' value='male'> Male
<input type='radio' name='gender' value='female'> Female<br><br>
<input type='checkbox' id='agree' name='agree' required>
<label for='agree'>I agree to terms</label><br><br>
<input type='submit' value='Register'>
</form>
Tip: To enhance accessibility, always utilize the “label” tag, linking it with “for” and “id” attributes.
Quick Recap — Forms
You have a better understanding of semantic HTML tags and how to use them for better structure. You also learned how to create forms and customize for different input types and attributes.
HTML Semantic Elements — W3Schools: https://www.w3schools.com/html/html5_semantic_elements.asp
HTML Forms — W3Schools: https://www.w3schools.com/html/html_forms.asp
HTML Input Types — W3Schools: https://www.w3schools.com/html/html_form_input_types.asp
HTML Attributes — W3Schools: https://www.w3schools.com/html/html_attributes.asp
LeetCode Practice:
https://leetcode.com/problemset/
GeeksforGeeks HTML Practice:
https://www.geeksforgeeks.org/html-tutorial/
Semantic HTML elements are tags that are explicitly defined in terms of purpose and meaning to the browsers and developers. They are <header>, <nav>, <article>, <section> and <footer>. They render web pages more accessible, search engine friendly and maintainable.
Semantic HTML aids in the interpretation of a webpage by screen readers and other assistive technologies. This enables users with disabilities to navigate content easily, enhancing general accessibility and adherence to web standards such as WCAG.
Semantic elements: Be clear about their purpose (e.g., <article> is a self-contained piece of content).
Non-semantic elements: Do not carry meaning (e.g., <div> or <span>).
Semantic tags enhance readability and search engine optimization over the use of generic <div> tags.
The following are some commonly used semantic tags:
The user input such as names, emails, feedback or payment details are collected using HTML forms. They are needed in interactive features like login systems, contact pages, and registration portals.
Copyright © 2025 Niotechone Software Solution Pvt. Ltd. All Rights Reserved.