E-Commerce Web Application
Built with React, Node.js, and PostgreSQL.
View Source CodeHTML stands for HyperText Markup Language. It is the standard language used to create and structure content on the web.
Every website you visit uses HTML in some form. HTML provides the structure of a webpage, similar to how the skeleton provides structure to the human body.
With HTML, developers can create:
HyperText refers to text that contains links connecting one page to another.
For example, when you click a link on a website and move to another page, you are using hypertext.
A markup language uses special tags to describe the structure of content.
HTML tags tell the browser:
A basic HTML page contains several important parts.
| Tag | Purpose |
|---|---|
<!DOCTYPE html> |
Defines the document type |
<html> |
Root element of the webpage |
<head> |
Contains metadata and page information |
<body> |
Contains visible webpage content |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My First Page</title>
</head>
<body>
<h1>Hello, World!</h1>
<p>Welcome to <strong>HTML</strong>.</p>
</body>
</html>
<h1> creates a main heading<p> creates a paragraph<strong> makes text bold and important<title> sets the browser tab titleWeb browsers like Chrome, Firefox, and Edge read HTML files and convert them into visual webpages.
The browser does not display the tags themselves. Instead, it interprets them and renders the final page for users.
HTML uses tags enclosed inside angle brackets.
Example:
<p>This is a paragraph.</p>
In this example:
<p> is the opening tag</p> is the closing tag| Element | Description |
|---|---|
<h1> to <h6> |
Headings |
<p> |
Paragraph |
<a> |
Hyperlink |
<img> |
Image |
<ul> |
Unordered list |
<ol> |
Ordered list |
<div> |
Container element |
HTML is a markup language, not a programming language.
It cannot perform calculations, create logic, or make decisions on its own.
HTML is commonly used together with:
To start writing HTML, you only need:
HTML files must be saved using the .html extension.
Example:
index.html
After saving the file, double-click it to open it in your web browser.
Practice HTML, CSS, and JavaScript right here in your browser! Modify the code below and click "Run" to see your changes instantly.
Create a simple HTML page with your name as the title, add a heading, and a paragraph.
Create a webpage containing:
Create an about.html page introducing yourself with:
Every HTML webpage follows a standard structure known as the HTML boilerplate.
This structure helps browsers correctly understand and display the webpage content.
A well-structured HTML document improves:
The following is the basic structure of a modern HTML5 document.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page Title</title>
</head>
<body>
<!-- Content here -->
</body>
</html>
Let us break down the document structure step by step.
This declaration tells the browser that the document uses HTML5.
Without it, browsers may switch to older rendering modes that can cause layout issues.
The <html> tag is the root element of the webpage.
Everything inside the webpage must be placed between:
<html>
...
</html>
lang AttributeThe lang="en" attribute specifies the language of the webpage.
This helps:
The <head> section contains information about the webpage that is not directly visible
on the page.
Common elements inside the head section include:
This meta tag sets the character encoding to UTF-8.
UTF-8 supports most characters and symbols used worldwide.
Without proper encoding, some text may display incorrectly.
This tag helps webpages display correctly on mobile devices.
It makes responsive design possible by controlling page scaling and width.
<meta name="viewport" content="width=device-width, initial-scale=1.0">
The <title> tag defines the title shown in the browser tab.
Example:
<title>My Portfolio</title>
This title also appears in search engine results.
The <body> section contains all visible webpage content.
Examples include:
Comments are notes written inside the code that browsers ignore.
They help developers explain sections of code.
<!-- This is a comment -->
Indentation makes HTML code easier to read and maintain.
Compare the following examples:
<body>
<h1>Title</h1>
<p>Paragraph</p>
</body>
<body>
<h1>Title</h1>
<p>Paragraph</p>
</body>
Proper formatting becomes extremely important in large projects.
Modern HTML uses semantic elements that describe the meaning of content.
| Element | Purpose |
|---|---|
<header> |
Top section of a webpage |
<nav> |
Navigation links |
<main> |
Main page content |
<section> |
Content section |
<article> |
Independent content block |
<footer> |
Bottom section of the page |
<body>
<header>
<h1>My Website</h1>
</header>
<nav>
Navigation Menu
</nav>
<main>
Main Content
</main>
<footer>
Copyright 2026
</footer>
</body>
.html extensionTyping the following in VS Code:
!
and pressing Tab automatically generates the complete HTML boilerplate.
Create a complete HTML5 boilerplate manually without copying the example.
Create a webpage with:
Create a semantic webpage using:
<header><nav><main><footer>Text is one of the most important parts of every webpage. HTML provides several elements to structure and format text properly.
Good typography improves:
HTML text elements help browsers and search engines understand the importance of content on a webpage.
HTML provides six heading levels from <h1> to <h6>.
These headings create a content hierarchy similar to chapters and subheadings in a book.
<h1>Main Page Title</h1>
<h2>Major Section</h2>
<h3>Subsection</h3>
<h4>Sub-subsection</h4>
| Heading | Purpose |
|---|---|
<h1> |
Main title of the webpage |
<h2> |
Main section heading |
<h3> |
Subsection heading |
<h4> - <h6> |
Smaller nested sections |
Headings are not only used for making text bigger. They provide semantic meaning to content.
Proper heading usage helps:
A webpage should usually contain only one primary <h1>.
The <p> tag is used to create paragraphs.
<p>HTML is the foundation of web development.</p>
<p>It helps structure content on webpages.</p>
Browsers automatically add spacing before and after paragraphs.
The <br> tag inserts a line break.
<p>
Hello<br>
Welcome to HTML
</p>
The <br> tag does not require a closing tag.
The <hr> tag creates a horizontal line used to separate content sections.
<h2>Chapter 1</h2>
<hr>
<h2>Chapter 2</h2>
HTML provides multiple ways to emphasise text.
| Tag | Purpose |
|---|---|
<b> |
Bold text without semantic importance |
<strong> |
Important text with semantic meaning |
<p>
<strong>Warning:</strong> Save your work regularly.
</p>
| Tag | Purpose |
|---|---|
<i> |
Italic text without emphasis |
<em> |
Text with emphasis |
<p>
<em>Important:</em> Complete the assignment today.
</p>
The <small> tag displays smaller-sized text.
<p>
Copyright <small>2026</small>
</p>
These tags are commonly used in mathematics and chemistry.
| Tag | Example Usage |
|---|---|
<sub> |
H₂O |
<sup> |
x² |
<p>H<sub>2</sub>O</p>
<p>x<sup>2</sup></p>
The <pre> tag preserves spaces and line breaks exactly as written.
<pre>
Line 1
Line 2
Line 3
</pre>
The <code> tag is used for displaying programming code.
<p>
Use the <code>print()</code> function in Python.
</p>
HTML provides tags for quotations and cited text.
| Tag | Purpose |
|---|---|
<blockquote> |
Long quotation |
<q> |
Short inline quotation |
<q>Knowledge is power.</q>
Some characters are reserved in HTML and must be written using entities.
| Character | Entity |
|---|---|
| < | < |
| > | > |
| & | & |
<strong> and <em>Create a webpage containing all heading levels from <h1> to
<h6>.
Create a webpage with:
Create a mini article page using:
Links are one of the most important features of the web.
They allow users to move between webpages, websites, sections, documents, and resources.
HTML uses the <a> tag, also called the anchor tag, to create
hyperlinks.
The basic syntax of a hyperlink is:
<a href="https://example.com">Visit Website</a>
The href attribute specifies the destination URL.
| Type | Description |
|---|---|
| External Link | Opens another website |
| Internal Link | Opens another page within the same website |
| Anchor Link | Jumps to a section on the same page |
| Email Link | Opens the user's email application |
| Telephone Link | Starts a phone call on supported devices |
External links connect users to other websites.
<a href="https://www.google.com">
Visit Google
</a>
The target="_blank" attribute opens the link in a new browser tab.
<a href="https://example.com"
target="_blank"
rel="noopener">
Open New Tab
</a>
rel="noopener"?The rel="noopener" attribute improves security when opening new tabs.
It prevents the new webpage from accessing the original page through JavaScript.
Internal links connect pages inside the same website.
Example folder structure:
project/
│
├── index.html
├── about.html
└── contact.html
Example internal link:
<a href="/about">
About Us
</a>
Anchor links jump to specific sections on the same webpage.
<a href="#section">Jump to Section</a>
<h2 id="section">Section</h2>
The id attribute identifies the target element.
The mailto: protocol opens the user's default email application.
<a href="mailto:[email protected]">
Send Email
</a>
The tel: protocol is mainly used on mobile devices for phone calls.
<a href="tel:+1234567890">
Call Now
</a>
The download attribute allows users to download files instead of opening them.
<a href="notes.pdf" download>
Download Notes
</a>
An image can also be wrapped inside an anchor tag.
<a href="https://example.com">
<img src="logo.png" alt="Logo">
</a>
Navigation menus help users move through a website.
HTML commonly uses the <nav> element for navigation sections.
<nav>
<a href="/">Home</a>
<a href="/about">About</a>
<a href="/contact">Contact</a>
</nav>
| Type | Example |
|---|---|
| Relative URL | about.html |
| Absolute URL | https://example.com/about.html |
Links can have different visual states:
These states are usually styled using CSS.
<a href="course.html">Click Here</a>
<a href="course.html">
View HTML Course
</a>
href attributeCreate a webpage containing:
Create a navigation menu with links for:
Create a long webpage with multiple sections and use anchor links to jump between them.
Websites become more engaging when they include images, audio, videos, and other media elements.
HTML provides built-in tags for displaying media content directly inside webpages.
In this lecture, you will learn how to:
The <img> tag is used to display images in HTML.
Unlike many HTML elements, the image tag does not have a closing tag.
<!-- Basic image -->
<img src="photo.jpg" alt="Description">
<!-- With dimensions -->
<img src="photo.jpg" alt="Description"
width="600" height="400">
<!-- Figure with caption -->
<figure>
<img src="chart.png" alt="Chart">
<figcaption>Figure 1: Sales</figcaption>
</figure>
| Attribute | Purpose |
|---|---|
src |
Specifies the image file path |
alt |
Alternative text for accessibility |
width |
Sets image width |
height |
Sets image height |
The alt attribute is extremely important for accessibility and SEO.
Screen readers use alt text to describe images to visually impaired users.
If an image fails to load, the alt text is displayed instead.
<img src="cat.jpg"
alt="A white cat sitting on a chair">
| Format | Best Used For |
|---|---|
| JPG / JPEG | Photographs and realistic images |
| PNG | Transparent backgrounds and graphics |
| SVG | Icons and vector graphics |
| GIF | Simple animations |
| WebP | Modern compressed web images |
Images can be loaded using relative or absolute paths.
<!-- Relative path -->
<img src="images/photo.jpg" alt="Photo">
<!-- Absolute URL -->
<img src="https://example.com/photo.jpg"
alt="Online Photo">
The <figure> element groups media content together.
The <figcaption> tag provides a caption for the content.
<figure>
<img src="nature.jpg" alt="Nature">
<figcaption>
Beautiful mountain landscape
</figcaption>
</figure>
Responsive images automatically adjust to different screen sizes.
<img src="photo.jpg"
alt="Responsive image"
style="max-width:100%; height:auto;">
This technique prevents images from overflowing on smaller screens.
The <audio> tag embeds sound files into webpages.
<audio controls>
<source src="music.mp3" type="audio/mpeg">
Your browser does not support audio.
</audio>
| Attribute | Purpose |
|---|---|
controls |
Displays play/pause buttons |
autoplay |
Automatically starts audio |
loop |
Repeats the audio continuously |
muted |
Starts audio muted |
The <video> tag is used for embedding videos.
<video width="640"
height="360"
controls>
<source src="movie.mp4"
type="video/mp4">
Your browser does not support video.
</video>
YouTube videos are commonly embedded using an iframe.
<iframe width="560"
height="315"
src="https://www.youtube.com/embed/VIDEO_ID"
title="YouTube video"
allowfullscreen>
</iframe>
The poster attribute displays an image before the video starts.
<video controls
poster="thumbnail.jpg">
<source src="movie.mp4"
type="video/mp4">
</video>
Lazy loading delays image loading until the image becomes visible on screen.
<img src="photo.jpg"
alt="Photo"
loading="lazy">
alt attributeCreate a webpage containing:
Create a webpage with:
Create a small gallery page using multiple responsive images.
Lists and tables are essential HTML elements used to organize and display information clearly. Lists help group related items together, while tables are used to display structured data in rows and columns.
Websites use lists for menus, navigation bars, feature sections, tutorials, and instructions. Tables are commonly used for schedules, pricing charts, marksheets, reports, and data presentation.
HTML provides three main types of lists:
<!-- Unordered -->
<ul>
<li>Apples</li>
<li>Bananas</li>
</ul>
<!-- Ordered -->
<ol>
<li>Step 1</li>
<li>Step 2</li>
</ol>
<!-- Description -->
<dl>
<dt>HTML</dt>
<dd>HyperText Markup</dd>
</dl>
Unordered lists use bullet points to display items where sequence or order does not matter.
<ul>
<li>Milk</li>
<li>Bread</li>
<li>Eggs</li>
</ul>
The <ul> tag creates the unordered list, while each item is added using the
<li> tag.
Ordered lists are used when the order of items is important, such as instructions or rankings.
<ol>
<li>Open VS Code</li>
<li>Create a file</li>
<li>Save the document</li>
</ol>
Browsers automatically number items inside an ordered list.
You can change the numbering style of ordered lists using the type attribute.
<ol type="A">
<li>HTML</li>
<li>CSS</li>
</ol>
Possible values for the type attribute include:
1 → Numbers (default)A → Uppercase lettersa → Lowercase lettersI → Roman numeralsi → Lowercase Roman numeralsDescription lists are used for terms and definitions, similar to a glossary or dictionary.
<dl>
<dt>CPU</dt>
<dd>Central Processing Unit</dd>
<dt>RAM</dt>
<dd>Random Access Memory</dd>
</dl>
The <dt> tag represents the term, while <dd> provides its
description.
Lists can also contain other lists inside them. This is called nesting.
<ul>
<li>Frontend
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>
</li>
</ul>
Nested lists are commonly used in navigation menus and category structures.
HTML tables are used to organize data into rows and columns. Tables are useful for displaying schedules, reports, marksheets, pricing tables, and structured datasets.
<table border="1">
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>Alice</td>
<td>21</td>
</tr>
</table>
<table> → Creates the table<tr> → Creates a table row<th> → Creates a table heading cell<td> → Creates a table data cellThe border attribute adds borders around table cells.
<table border="2">
<tr>
<th>Course</th>
<th>Duration</th>
</tr>
<tr>
<td>HTML</td>
<td>4 Weeks</td>
</tr>
</table>
Modern websites usually style tables using CSS instead of the HTML border attribute.
You can merge cells horizontally using colspan and vertically using
rowspan.
<table border="1">
<tr>
<th colspan="2">Student Info</th>
</tr>
<tr>
<td>John</td>
<td>20</td>
</tr>
</table>
The colspan="2" attribute merges two columns into one.
<th> for headings instead of normal cells<li> tags<th> and <td><tr>Create an unordered list containing five of your favorite foods.
Create an ordered list showing the steps to create an HTML file and open it in a browser.
Create a table with three columns: Name, Subject, and Marks. Add at least three student records.
HTML forms allow users to send data to a website. Forms are used everywhere on the web — login pages, registration systems, search bars, contact forms, payment systems, and surveys all depend on forms.
Forms collect user input using different input elements such as text fields, buttons, checkboxes, radio buttons, dropdowns, and text areas.
The <form> tag acts as a container for all form elements.
<form action="/submit" method="POST">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<button type="submit">Submit</button>
</form>
action → specifies where form data is sentmethod → defines how data is transmittedPOST → sends data securely in the request bodyGET → sends data through the URLPOST for sensitive data like passwords and user information. Use GET for
searches and filters.
The <label> tag improves accessibility and usability. Clicking the label automatically
focuses the related input field.
<label for="username">Username:</label>
<input type="text" id="username">
The value of the for attribute must match the input's id.
Text fields allow users to enter single-line text.
<input type="text" placeholder="Enter your name">
The placeholder attribute displays temporary helper text inside the field.
The email input type validates email addresses automatically.
<input type="email" required>
If the entered value is not a valid email format, the browser will display a validation error.
Password fields hide typed characters for security.
<input type="password">
Number fields only accept numeric values.
<input type="number" min="1" max="100">
The min and max attributes define the allowed range.
Checkboxes allow users to select multiple options.
<input type="checkbox" id="html">
<label for="html">HTML</label>
<input type="checkbox" id="css">
<label for="css">CSS</label>
Users can check more than one checkbox at the same time.
Radio buttons allow users to select only one option from a group.
<input type="radio" name="gender" id="male">
<label for="male">Male</label>
<input type="radio" name="gender" id="female">
<label for="female">Female</label>
Radio buttons must share the same name value to behave as a group.
The <textarea> element allows multi-line text input.
<textarea rows="5" cols="30"></textarea>
This is commonly used for comments, messages, and descriptions.
Dropdown menus provide a list of selectable options.
<select>
<option>HTML</option>
<option>CSS</option>
<option>JavaScript</option>
</select>
Buttons are used to submit form data.
<button type="submit">Send</button>
When clicked, the browser sends all form data to the location defined in the
action attribute.
Reset buttons restore all form fields to their default values.
<button type="reset">Reset</button>
The required attribute prevents users from submitting empty fields.
<input type="text" required>
Browser validation happens automatically before submission.
Placeholders provide temporary hints inside input fields.
<input type="text" placeholder="Enter username">
Placeholders disappear when the user starts typing.
File inputs allow users to upload files from their computer.
<input type="file">
This is commonly used for profile pictures, assignments, and document uploads.
HTML5 introduced specialized date and time input fields.
<input type="date">
<input type="time">
Modern browsers automatically display date and time pickers.
Organizing forms properly improves readability and accessibility.
<fieldset>
<legend>Personal Information</legend>
<label>Name:</label>
<input type="text">
</fieldset>
<fieldset> groups related fields together<legend> provides a title for the group| GET | POST |
|---|---|
| Data appears in URL | Data sent in request body |
| Less secure | More secure |
| Used for searches | Used for login/signup forms |
name attributeCreate a registration form containing name, email, password, and submit button fields.
Create a feedback form using a textarea, radio buttons, and checkboxes.
Create a student admission form with dropdown menus, date input, and file upload support.
Semantic HTML means using HTML elements according to their meaning and purpose instead of only for visual structure. Semantic elements clearly describe what their content represents to browsers, developers, search engines, and assistive technologies.
Before HTML5, developers heavily relied on generic containers like <div> and
<span>. Semantic HTML introduced meaningful tags that make webpages more organized,
accessible, and easier to maintain.
HTML5 introduced several semantic layout elements used in modern webpage structure.
<header> <!-- Site header -->
<nav> <!-- Navigation -->
<main> <!-- Primary content -->
<article> <!-- Self-contained -->
<section> <!-- Thematic group -->
<aside> <!-- Sidebar -->
<footer> <!-- Footer -->
The <header> element represents introductory content or a top section of a webpage or
article.
<header>
<h1>My Blog</h1>
<p>Learn web development</p>
</header>
Headers commonly contain logos, navigation menus, titles, or introductory text.
The <nav> element contains navigation links.
<nav>
<a href="#">Home</a>
<a href="#">Courses</a>
<a href="#">Contact</a>
</nav>
Screen readers use the navigation element to help users quickly move through site menus.
The <main> element represents the primary content of the webpage.
<main>
<h2>Welcome to our website</h2>
<p>This is the main content area.</p>
</main>
<main> element because it represents the
core content of the page.
The <section> tag groups related content together.
<section>
<h2>About Us</h2>
<p>We teach coding online.</p>
</section>
Sections are thematic groups of content and usually contain headings.
The <article> element represents self-contained content that can stand on its own.
<article>
<h2>How to Learn HTML</h2>
<p>Start with basic tags and structure.</p>
</article>
Articles are commonly used for blog posts, news stories, tutorials, or forum posts.
The <aside> tag contains related but secondary content.
<aside>
<h3>Related Courses</h3>
<p>Learn CSS and JavaScript next.</p>
</aside>
Asides are often used for sidebars, advertisements, tips, or related links.
The <footer> element represents the bottom section of a webpage or article.
<footer>
<p>© 2026 Code Tutorium</p>
</footer>
Footers usually contain copyright information, contact details, or social media links.
| Semantic | Non-Semantic |
|---|---|
| <header> | <div> |
| <article> | <span> |
| <footer> | <div> |
Non-semantic elements do not describe their meaning, while semantic elements provide context and structure.
<body>
<header>
<h1>My Website</h1>
</header>
<nav>
<a href="#">Home</a>
<a href="#">About</a>
</nav>
<main>
<section>
<h2>Latest Tutorials</h2>
<article>
<h3>Learn HTML</h3>
<p>HTML is the foundation of web development.</p>
</article>
</section>
<aside>
Related resources here
</aside>
</main>
<footer>
<p>Copyright 2026</p>
</footer>
</body>
Semantic HTML greatly improves accessibility for users with disabilities.
Search engines use semantic structure to better understand webpage content.
Even though semantic elements are preferred, <div> is still useful when no semantic
element fits the situation.
<div class="card">
Custom content here
</div>
Use semantic elements whenever possible, and use <div> as a generic container only when
necessary.
<div> elements<section> without headings<main> elements on one page<article> and <section>Create a webpage using <header>, <nav>,
<main>, and <footer> elements.
Create a blog layout using <article> and <section> elements.
Convert a webpage made entirely with <div> tags into a semantic HTML layout.
HTML is the foundation of web development. Continue your journey with:
<details>
<summary>What is HTML?</summary>
<p>HTML is a markup language.</p>
</details>
<button aria-label="Close menu">X</button>
<nav aria-label="Main navigation">...</nav>
<meta name="description" content="Page description">
<meta name="keywords" content="html, css, javascript">
<meta name="author" content="Your Name">
<meta property="og:title" content="Page Title">
Create a complete personal portfolio website using everything learned:
Content coming soon...
Content coming soon...
Content coming soon...
Build a modern, fully accessible HTML5 single-page developer portfolio using semantic elements like
Master clean HTML structure, accessible ARIA attributes, semantic headings hierarchy (H1-H3), and embedded media elements.
Jane Doe — Senior Full Stack Developer
Hi, I'm Jane Doe
Full-Stack Web Developer specializing in React, Node.js, and Cloud Solutions.
Featured Projects
E-Commerce Web Application
Built with React, Node.js, and PostgreSQL.
View Source Code
Get In Touch
Add an embedded