Understand HTML
Understand HTML as the markup language that describes the structure and meaning of web content.
Build the structure of real web pages using HTML documents, elements, attributes, headings, paragraphs, links, lists, images and correct nesting.
Build a strong HTML foundation before moving into semantic page structure.
Understand HTML as the markup language that describes the structure and meaning of web content.
Create a correct HTML document using doctype, html, head and body.
Work confidently with tags, elements, content and attributes.
Use anchors and href correctly for navigation.
Use headings, paragraphs, ordered lists and unordered lists appropriately.
Use meaningful alt text, correct nesting and logical heading hierarchy.
HTML gives a browser the structural description of a document.
HTML stands for HyperText Markup Language. It is the standard markup language used to structure content on the Web.
HTML is not primarily responsible for visual styling or application logic. It describes what content represents: a heading, paragraph, link, list, image, section and many other kinds of content.
HTML โ Structure and meaning
CSS โ Presentation and layout
JavaScript โ Behaviour and interaction
A useful beginner rule is: first structure the content, then style it, then add behaviour.
Understand the major parts before writing individual elements.
Document declaration used at the beginning of the HTML document.
Root element of the HTML document.
Contains metadata and document information.
Contains the page content presented to users.
The standard starting point for a modern HTML page.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
>
<title>
My Web Page
</title>
</head>
<body>
<h1>
Hello Web
</h1>
<p>
Welcome to HTML.
</p>
</body>
</html>
Contains metadata, title, linked resources and other document information.
Contains the content that forms the document presented to the user.
Learn the terminology used when discussing HTML.
<p>
Learn HTML with CodeBhavya.
</p>
| Part | Example | Meaning |
|---|---|---|
| Opening tag | <p> | Starts the paragraph element. |
| Content | Learn HTML... | Text inside the element. |
| Closing tag | </p> | Ends the paragraph element. |
| Complete element | <p>...</p> | Complete paragraph structure. |
Some elements are
void elements.
They do not contain normal child content and do not
use a separate closing tag, such as
<img> and
<br>.
Attributes add information or configuration to elements.
<a
href="https://codebhavya.com"
target="_blank"
>
Visit CodeBhavya
</a>
| Attribute | Common Purpose |
|---|---|
| href | Destination of a link. |
| src | Source of an embedded resource. |
| alt | Alternative text for an image. |
| id | Identifies a particular element. |
| class | Groups elements for CSS or JavaScript. |
| lang | Declares the language of a document or element. |
Use content hierarchy rather than choosing elements only for their default size.
HTML provides six heading levels, from
h1 through h6.
They communicate hierarchy.
Paragraphs are represented by the
p element.
<h1>
Web Technologies
</h1>
<h2>
HTML
</h2>
<h3>
HTML Fundamentals
</h3>
<p>
HTML gives a document structure and meaning.
</p>
Connect documents and resources using the anchor element.
The <a> element creates a hyperlink.
Its href attribute identifies the destination.
<a href="https://codebhavya.com">
CodeBhavya
</a>
<a href="about.html">
About Us
</a>
<a href="#contact">
Contact Section
</a>
A complete web address such as
https://example.com/page.
A path such as
about.html relative to the
current website or document.
Represent ordered and unordered collections of related items.
<ul>
<li>
HTML
</li>
<li>
CSS
</li>
<li>
JavaScript
</li>
</ul>
<ol>
<li>
Learn HTML
</li>
<li>
Learn CSS
</li>
<li>
Learn JavaScript
</li>
</ol>
li represents an individual list item.
Choose ordered or unordered lists according to the
meaning of the content.
Embed images while preserving useful alternative information.
<img
src="images/student.jpg"
alt="Student learning web technologies"
>
| Attribute | Purpose |
|---|---|
| src | Identifies the image resource. |
| alt | Provides a text alternative for meaningful images. |
| width / height | Can communicate intended dimensions. |
Elements can contain other elements, but the hierarchy must remain valid.
<section>
<h2>
HTML
</h2>
<p>
Learn
<strong>
HTML
</strong>
step by step.
</p>
</section>
The strong element is inside the paragraph,
and the paragraph is inside the section.
Closing tags should follow the reverse order in which
nested elements were opened.
Open section
Open p
Open strong
Close strong
Close p
Close section
Keep source code understandable without confusing presentation with meaning.
<!-- Main page heading -->
<h1>
Student Portal
</h1>
<!-- Introduction -->
<p>
Manage your academic information.
</p>
Comments are ignored as visible page content. Whitespace and indentation improve source readability, while indentation itself does not create HTML hierarchy.
Some attributes can be used across many different HTML elements.
Identifies a specific element and should be unique within the document.
Associates an element with one or more reusable groups.
Provides advisory information about an element in suitable contexts.
Communicates the language of text for the document or a specific element.
<html lang="en">
<p
id="intro"
class="lead-text"
>
Welcome to CodeBhavya.
</p>
Separate structure, presentation and behaviour.
Defines document structure and meaning.
<button>
Save
</button>
Controls appearance and layout.
.button {
padding:
10px;
}
Responds to actions and changes application state.
button.addEventListener(
"click",
save
);
Turn a simple requirement into a structured HTML document.
Suppose a college wants a student portal page. Before adding CSS or JavaScript, HTML can establish the content structure.
<h1>
Student Portal
</h1>
<p>
Welcome, Bhavya.
</p>
<h2>
Academic Details
</h2>
<ul>
<li>
CSE-AI&ML
</li>
<li>
Semester 06
</li>
<li>
CGPA 8.42
</li>
</ul>
<h2>
Resources
</h2>
<a href="results.html">
View Results
</a>
Trace how a browser processes the major parts of a basic HTML document.
The browser starts processing the HTML document.
The active stage shows one important part of the document parsing journey.
Select a building block and see how it fits into a simple document.
Recognize mistakes before they become habits.
<p>
<strong>
Hello
</p>
</strong>
Close nested elements in the reverse order of opening.
<p>
<strong>
Hello
</strong>
</p>
<img
src="student.jpg"
>
Meaningful images should have useful alternative text.
<img
src="student.jpg"
alt="Student"
>
<h1>
Tiny detail
</h1>
Choose heading levels according to document hierarchy, not simply visual size.
<a>
Click here
</a>
Use a meaningful destination when the element represents a link.
<a href="results.html">
Results
</a>
Click each card to reveal the answer. Try answering before flipping.
HTML is a markup language used to structure and describe the meaning of content in web documents.
A tag is markup such as
<p>.
An element is the complete structure,
such as
<p>Hello</p>,
including content where applicable.
It tells the browser that the document should be interpreted as HTML and helps trigger standards-based rendering.
An attribute provides additional information or configuration for an element and is normally written in its opening tag.
Alternative text provides a textual replacement for meaningful images when they cannot be perceived visually and supports accessible use.
Semantic HTML uses elements according to their meaning and purpose instead of choosing elements only for appearance. The next level explores this deeply.
Test your understanding. Each question accepts one answer.
Build small pages without copying the examples above.
Create a personal profile page containing your name, a short introduction and three skills.
Create a learning-resources page containing three meaningful links and a heading hierarchy.
Create a student profile with name, course, skills, image with alt text and a CodeBhavya link.
Create a college department page with a main heading, two sections and lists of courses.
Write a valid HTML document from memory without looking at the basic template.
Inspect one of your old HTML pages and identify at least five elements and five attributes.
Remember these points before moving to Semantic HTML.
HTML describes the structure and meaning of web content.
DOCTYPE identifies the document type and supports standards-based rendering.
html is the root element; head contains metadata and body contains document content.
Attributes provide additional information inside opening tags.
h1โh6 communicate heading hierarchy; p represents paragraphs.
a creates links and href specifies their destination.
ul, ol and li represent unordered lists, ordered lists and list items.
img embeds an image and meaningful images should have appropriate alt text.
Nested elements should be closed in the correct order.
HTML is structure, CSS is presentation and JavaScript provides behaviour.
Click a term to flip the card and reveal its meaning.
HyperText Markup Language used to structure and describe web content.
A complete HTML structure consisting of tags and content where applicable.
Additional information written in an element's opening tag.
A document declaration that identifies the HTML document type.
The a element used to create hyperlinks and navigation.
Placing one HTML element inside another while maintaining correct hierarchy.
Text that provides an alternative description for a meaningful image.
An element that does not contain normal child content and does not use a separate closing tag.
Finish the lesson and mark this topic as completed.