HTML Tutorial PDF (1)
HTML Tutorial PDF (1)
HTML
TUTORIAL
THE COMPLETE PRACTICAL GUIDE
COVERS ALL HTML5 NEW ELEMENTS <HTML>
STRUCTURE
<CSS>
PRESENTATION
Runnable examples
162 Reference tables / Live lesson links
CHAPTERS
</>
WRITTEN AND PUBLISHED BY
Swapnil Raja
[Link]
HTML TUTORIAL
About this book
HTML Tutorial is a complete offline learning companion published by HTML5ANDCSS3. It contains
162 published chapters, practical explanations, code examples, reference tables, and direct links to
the continuously updated lessons on the website.
Edition information
Digital edition generated 2026-08-05
Content last updated 2026-07-30
Official book page: [Link]
HTML5ANDCSS3 | [Link] 1
Table of contents
29. HTML Div & Span ................................................................... 111
HTML BASICS
30. HTML Semantic Layout Tags ............................................... 116
1. Introduction to HTML .................................................................... 5 31. HTML Iframes .......................................................................... 119
2. HTML Editors .................................................................................. 9
ADVANCED HTML
3. HTML Structure ............................................................................ 12
4. HTML Elements & Attributes .................................................... 15 32. HTML Entities & Symbols ..................................................... 122
5. HTML Headings ........................................................................... 18 33. HTML Emojis ............................................................................ 125
6. HTML Paragraphs ....................................................................... 21 34. HTML Head Element Tags ................................................... 128
7. HTML Formatting ......................................................................... 24 35. HTML Meta Tags for SEO ..................................................... 132
8. HTML Comments ......................................................................... 27 36. HTML Responsive Design .................................................... 137
9. HTML Styles .................................................................................. 30
HTML REFERENCES
HTML TEXT AND LINKS
37. HTML5 New Tags .................................................................... 143
10. HTML Text Formatting .............................................................. 34 38. Deprecated Tags ..................................................................... 150
11. HTML Quotations & Citations ................................................ 38 39. HTML Global Attributes ......................................................... 154
12. HTML Links ................................................................................. 41 40. Event Attributes ....................................................................... 159
13. HTML Email Links ..................................................................... 45 41. Complete HTML Tag List ...................................................... 168
42. Complete HTML5 Elements ................................................. 175
HTML LISTS AND TABLES
HTML TAGS
14. HTML Lists .................................................................................. 48
15. HTML Tables ............................................................................... 51 43. HTML <!DOCTYPE> Tag ...................................................... 178
16. Table Styling & Borders ........................................................... 58 44. HTML <html> Tag .................................................................... 180
45. HTML <head> Tag .................................................................. 182
HTML IMAGES AND MEDIA
46. HTML <title> Tag ..................................................................... 184
17. HTML Images ............................................................................. 65 47. HTML <body> Tag .................................................................. 186
18. HTML Picture Element ............................................................. 69 48. HTML <base> Tag .................................................................. 188
19. HTML Audio ................................................................................ 71 49. HTML <link> Tag ..................................................................... 190
20. HTML Video ................................................................................ 74 50. HTML <meta> Tag .................................................................. 192
21. HTML Embed & Object ............................................................ 77 51. HTML <style> Tag ................................................................... 194
52. HTML <script> Tag ................................................................. 197
HTML FORMS
53. HTML <h1 to h6> Tag ............................................................ 199
22. HTML Forms Overview ............................................................ 82 54. HTML <hgroup> Tag .............................................................. 201
23. HTML Form Elements .............................................................. 85 55. HTML <p> Tag ......................................................................... 204
24. HTML Input Types ..................................................................... 88 56. HTML <br> Tag ........................................................................ 206
25. HTML Input Attributes .............................................................. 92 57. HTML <wbr> Tag ..................................................................... 208
26. HTML Form Attributes .............................................................. 99 58. HTML <hr> Tag ........................................................................ 211
27. HTML Form Validation ........................................................... 104 59. HTML <pre> Tag ...................................................................... 214
60. HTML <b> Tag ......................................................................... 217
HTML LAYOUT
61. HTML <strong> Tag ................................................................ 220
28. HTML Block vs Inline Elements .......................................... 108 62. HTML <i> Tag ........................................................................... 223
HTML5ANDCSS3 | [Link] 2
Contents continued
63. HTML <em> Tag ...................................................................... 226 104. HTML <th> Tag ...................................................................... 339
64. HTML <mark> Tag .................................................................. 229 105. HTML <td> Tag ...................................................................... 342
65. HTML <small> Tag .................................................................. 232 106. HTML <col> Tag .................................................................... 345
66. HTML <del> Tag ...................................................................... 235 107. HTML <colgroup> Tag ......................................................... 348
67. HTML <ins> Tag ...................................................................... 238 108. HTML <form> Tag ................................................................. 351
68. HTML <sub> Tag ..................................................................... 241 109. HTML <input> Tag ................................................................ 354
69. HTML <sup> Tag ..................................................................... 243 110. HTML <textarea> Tag .......................................................... 357
70. HTML <u> Tag ......................................................................... 245 111. HTML <button> Tag ............................................................. 360
71. HTML <blockquote> Tag ....................................................... 248 112. HTML <select> Tag .............................................................. 363
72. HTML <q> Tag ......................................................................... 251 113. HTML <selectedcontent> Tag ........................................... 366
73. HTML <cite> Tag ..................................................................... 253 114. HTML <option> Tag .............................................................. 370
74. HTML <abbr> Tag ................................................................... 256 115. HTML <optgroup> Tag ........................................................ 373
75. HTML <address> Tag ............................................................ 259 116. HTML <label> Tag ................................................................ 376
76. HTML <bdo> Tag ..................................................................... 262 117. HTML <fieldset> Tag ............................................................ 379
77. HTML <bdi> Tag ...................................................................... 265 118. HTML <legend> Tag ............................................................ 382
78. HTML <a> Tag ......................................................................... 268 119. HTML <datalist> Tag ............................................................ 385
79. HTML <nav> Tag ..................................................................... 271 120. HTML <output> Tag ............................................................. 388
80. HTML <ul> Tags ...................................................................... 273 121. HTML <meter> Tag .............................................................. 390
81. HTML <menu> Tag ................................................................. 276 122. HTML <progress> Tag ......................................................... 392
82. HTML <ol> Tag ........................................................................ 279 123. HTML <header> Tag ............................................................ 394
83. HTML <dl> Tag ........................................................................ 282 124. HTML <footer> Tag .............................................................. 396
84. HTML <img> Tag ..................................................................... 285 125. HTML <article> Tag .............................................................. 398
85. HTML <figure> Tag ................................................................. 287 126. HTML <section> Tag ............................................................ 401
86. HTML <figcaption> Tag ......................................................... 289 127. HTML <aside> Tag ............................................................... 403
87. HTML <audio> Tag ................................................................. 291 128. HTML <main> Tag ................................................................ 406
88. HTML <video> Tag ................................................................. 293 129. HTML <search> Tag ............................................................ 409
89. HTML <source> Tag ............................................................... 296 130. HTML <details> Tag ............................................................. 412
90. HTML <track> Tag ................................................................... 299 131. HTML <summary> Tag ....................................................... 415
91. HTML <embed> Tag ............................................................... 302 132. HTML <dialog> Tag .............................................................. 417
92. HTML <object> Tag ................................................................ 304 133. HTML <time> Tag ................................................................. 420
93. HTML <param> Tag (Obsolete) .......................................... 306 134. HTML <noscript> Tag .......................................................... 422
94. HTML <picture> Tag ............................................................... 308 135. HTML <slot> Tags ................................................................ 424
95. HTML <canvas> Tag .............................................................. 311 136. HTML <template> Tag ......................................................... 427
96. HTML <map> Tag ................................................................... 314 137. HTML <shadow> Tag (Obsolete) ..................................... 430
97. HTML <area> Tag ................................................................... 317 138. HTML <center> Tag ............................................................. 432
98. HTML <table> Tag .................................................................. 320 139. HTML <font> Tag .................................................................. 434
99. HTML <caption> Tag .............................................................. 324 140. HTML <big> Tag .................................................................... 436
100. HTML <thead> Tag ............................................................... 327 141. HTML <strike> Tag ............................................................... 438
101. HTML <tbody> Tag ............................................................... 330 142. HTML <tt> Tag ....................................................................... 440
102. HTML <tfoot> Tag ................................................................. 333 143. HTML <acronym> Tag ......................................................... 443
103. HTML <tr> Tag ....................................................................... 336 144. HTML <applet> Tag .............................................................. 446
HTML5ANDCSS3 | [Link] 3
Contents continued
145. HTML <frame> Tag .............................................................. 448
146. HTML <frameset> Tag ......................................................... 450
147. HTML <noframes> Tag ....................................................... 453
148. HTML <marquee> Tag ........................................................ 456
149. HTML <blink> Tag ................................................................. 460
150. HTML <s> Tag ....................................................................... 463
151. HTML <var> Tag ................................................................... 465
152. HTML <kbd> Tag .................................................................. 467
153. HTML <samp> Tag ............................................................... 469
154. HTML <code> Tag ................................................................ 472
155. HTML <dfn> Tag ................................................................... 474
156. HTML <div> Tag .................................................................... 476
157. HTML <span> Tag ................................................................ 479
158. HTML Comment Tag ............................................................ 482
159. HTML <data> Tag ................................................................. 484
160. HTML Ruby Annotations: <ruby>, <rt> and <rp> ........ 486
161. HTML <svg> Tag ................................................................... 489
162. HTML <basefont> Tag ......................................................... 493
HTML5ANDCSS3 | [Link] 4
<html>
CHAPTER 001 / HTML BASICS
Introduction to HTML
HTML (HyperText Markup Language) is the standard language for creating web pages. In this
introduction, you'll learn what HTML is, how it works, and why it forms the foundation of all websites
on the internet.
What is HTML?
HTML stands for HyperText Markup Language.
It is the standard language used to create webpages and web applications. HTML is not a programming
language - it is a markup language that tells the browser how to display content.
History of HTML:
Developed in 1991 by Tim Berners-Lee.
HTML5ANDCSS3 | [Link] 5
Introduction to HTML
HTML Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My First HTML Page</title>
</head>
<body>
<h1>Welcome to HTML Tutorial</h1>
<p>This is a simple introduction to HTML.</p>
</body>
</html>
Explanation:
All you need is a web browser like Google Chrome, Mozilla Firefox, Microsoft Edge, or Safari.
You can save your file with .html extension and then you can open the saved file by double clicking on it.
HTML5ANDCSS3 | [Link] 6
Introduction to HTML
HTML Example
To make changes:
Tip: Keep your editor and browser windows side by side - so you can code and preview quickly.
If you don't want to save files locally, you can test your code instantly using online Try it Editor
These allow you to write HTML, CSS, and JavaScript directly in your browser and see results instantly -
perfect for beginners.
HTML5ANDCSS3 | [Link] 7
Introduction to HTML
Browser Support
Conclusion
You can run and test your HTML code anywhere, even without internet access.
Start with simple pages, observe the browser output, and experiment - that's the best way to learn HTML!
HTML5ANDCSS3 | [Link] 8
<html>
CHAPTER 002 / HTML BASICS
HTML Editors
HTML code can be written using any simple text editor - you don't need fancy software to start.
However, as you progress, using an HTML editor can make your work faster, more accurate, and
easier to manage.
HTML editors highlight syntax, auto-complete tags, and help prevent errors - making them ideal for both
beginners and professionals.
Here's how you can create your first HTML file using Notepad (on Windows):
Steps:
Step 1: Open Notepad (press Windows + R, type notepad, and hit Enter).
HTML5ANDCSS3 | [Link] 9
HTML Editors
[Link]
<!DOCTYPE html>
<html>
<head>
<title>My First HTML Page</title>
</head>
<body>
<h1>Welcome to HTML!</h1>
<p>This is my first web page created in Notepad.</p>
</body>
</html>
Step 4: Save the file with the name [Link] (not [Link]).
Step 5: Double-click the file - it will open in your browser and display your web page.
HTML5ANDCSS3 | [Link] 10
HTML Editors
Browser Support
Conclusion
You can write HTML code using any editor - even a simple text editor is enough to get started.
But as you build more complex web pages, professional editors help improve speed, accuracy, and comfort.
Choose the one that fits your style best and start coding!
HTML5ANDCSS3 | [Link] 11
<html>
CHAPTER 003 / HTML BASICS
HTML Structure
<!DOCTYPE html>
<html>
<head>
<title>My Web Page</title>
</head>
<body>
<h1>Welcome to My Website</h1>
<p>This is a simple HTML document structure.</p>
</body>
</html>
<!DOCTYPE html>
HTML5ANDCSS3 | [Link] 12
HTML Structure
<html>
... all your content goes here ...
</html>
Everything you want to display on the webpage lives inside this tag.
<head>
<title>My First Page</title>
<meta charset="UTF-8">
<meta name="description" content="A simple HTML structure example">
</head>
HTML5ANDCSS3 | [Link] 13
HTML Structure
<body>
<h1>Hello, World!</h1>
<p>This is my first HTML page.</p>
</body>
HTML Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Basic HTML Structure</title>
</head>
<body>
<h1>Welcome to HTML Structure</h1>
<p>This example shows the essential building blocks of an HTML document.</p>
</body>
</html>
Browser Support
Conclusion
The structure of an HTML document forms the foundation of every web page.
Once you understand where each element belongs, building pages becomes much easier.
Always remember: the browser reads your HTML from top to bottom, so order matters!
HTML5ANDCSS3 | [Link] 14
<html>
CHAPTER 004 / HTML BASICS
HTML pages are built using elements - the building blocks of a web page.
Each element defines a specific part of the content such as headings, paragraphs, images, or links.
Elements often include attributes that provide extra information about that element.
Example
<p>This is a paragraph.</p>
In this example:
Example
<h1>Hello World!</h1>
Here <h1> is the start tag, and </h1> is the closing tag.
Some elements don't have content and don't require a closing tag - these are called empty (void) elements
.
HTML5ANDCSS3 | [Link] 15
HTML Elements & Attributes
<br>
<img src="[Link]" alt="My Image">
<hr>
Example
Example Explained:
- a -> Element
- href -> Attribute name
- [Link] -> Attribute value
HTML5ANDCSS3 | [Link] 16
HTML Elements & Attributes
Attribute Rules
- Attributes are written inside the opening tag.
- Always use lowercase names for attributes.
- Always enclose values in quotes (single or double).
- You can use multiple attributes inside one tag.
Example
Example
Browser Support
Conclusion
HTML elements define the structure, and attributes define the behavior and properties of those elements.
Mastering both is essential to build well-structured, accessible, and dynamic web pages.
HTML5ANDCSS3 | [Link] 17
<html>
CHAPTER 005 / HTML BASICS
HTML Headings
Example
Browsers automatically display <h1> as the largest text and <h6> as the smallest.
HTML5ANDCSS3 | [Link] 18
HTML Headings
Real Example
<h1>HTML Tutorial</h1>
<h2>Introduction</h2>
<h3>What is HTML?</h3>
<h4>History of HTML</h4>
This structure shows a clear hierarchy - just like chapters and sections in a book.
Styling Header
You can change color, size, font, or alignment using CSS - but thesemantic meaning of the tag remains the
same.
Browser Support
HTML5ANDCSS3 | [Link] 19
HTML Headings
Conclusion
HTML headings help both users and search engines understand your content.
Use them logically, consistently, and semantically - your pages will be easier to read, better organized, and
more SEO-friendly.
HTML5ANDCSS3 | [Link] 20
<html>
CHAPTER 006 / HTML BASICS
HTML Paragraphs
Paragraph Example
Example
<p>This
is one
paragraph.</p>
HTML5ANDCSS3 | [Link] 21
HTML Paragraphs
Example
Example
Example
Things to Remember
- Paragraphs cannot contain block-level elements (like <div> or <h1>).
- Always close the paragraph tag (</p>).
HTML5ANDCSS3 | [Link] 22
HTML Paragraphs
Browser Support
Conclusion
HTML paragraphs structure your text and make your web content clean, readable, and accessible.
Use them properly to separate ideas, add spacing, and create a natural reading flow for visitors.
HTML5ANDCSS3 | [Link] 23
<html>
CHAPTER 007 / HTML BASICS
HTML Formatting
HTML provides tags to format text on your web page - making it bold, italic, highlighted, or styled
semantically for emphasis.
Formatting improves readability and helps users understand important content.
Formatting Example
Formatting Example
HTML5ANDCSS3 | [Link] 24
HTML Formatting
Formatting Example
Formatting Example
<p>H<sub>2</sub>O is water.</p>
<p>E = mc<sup>2</sup> is Einstein's formula.</p>
Formatting Example
HTML5ANDCSS3 | [Link] 25
HTML Formatting
Formatting Example
Browser Support
Conclusion
HTML formatting tags let you enhance the appearance and meaning of text on your page.
Use semantic tags like <strong> and <em> for important content, and visual tags like <b> or <i> for
stylistic emphasis.
HTML5ANDCSS3 | [Link] 26
<html>
CHAPTER 008 / HTML BASICS
HTML Comments
Comments in HTML are notes or explanations added to your code for yourself or other developers.
They do not appear on the webpage, but are visible in the HTML source code. Comments make
your code easier to understand and maintain.
Comment Example
Single-line Comment
<p>This is a paragraph.</p>
<!-- This paragraph explains something important -->
HTML5ANDCSS3 | [Link] 27
HTML Comments
Multi-line Comment
<!--
This is a multi-line comment.
You can write explanations,
notes, or reminders here.
-->
<p>HTML comments are helpful for developers.</p>
Code Documentation
Debugging
Example
Organizing Code
Organizing Example
Important Notes
- Comments cannot be nested. Don't put <!-- --> inside another comment.
- Avoid overusing comments - only use them where necessary for clarity.
- Comments are visible in the browser's "View Page Source", so don't include sensitive information.
HTML5ANDCSS3 | [Link] 28
HTML Comments
Browser Support
Conclusion
HTML comments are an essential tool for code documentation, organization, and debugging.
They help developers understand, maintain, and collaborate on projects without affecting what users see on
the webpage.
HTML5ANDCSS3 | [Link] 29
<html>
CHAPTER 009 / HTML BASICS
HTML Styles
HTML allows you to style your web page content to make it visually appealing.
Styles define colors, fonts, spacing, and layout of elements. You can apply styles inline, internally, or
externally using CSS.
a) Inline Styles
HTML5ANDCSS3 | [Link] 30
HTML Styles
b) Internal Styles
<head>
<style>
p {
color: red;
font-size: 16px;
}
</style>
</head>
<body>
<p>This paragraph is styled using internal CSS.</p>
</body>
c) External Styles
Stored in a separate .css file and linked to HTML using <link> in <head>.
<head>
<link rel="stylesheet" href="[Link]">
</head>
[Link]:
Style Example
body {
background-color: #f0f0f0;
}
h1 {
color: #29AB87;
}
HTML5ANDCSS3 | [Link] 31
HTML Styles
<p style="color: white; background-color: #29AB87; font-size: 18px; padding: 10px; text-align: ce
nter;">
Styled paragraph with multiple properties.
</p>
This paragraph has text color, background color, font size, padding, and centered alignment.
Example HTML
HTML5ANDCSS3 | [Link] 32
HTML Styles
Example CSS
.highlight {
color: #29AB87;
font-weight: bold;
}
Avoid overusing inline styles for cleaner code and better maintainability.
Browser Support
Conclusion
HTML styles enhance the appearance and readability of your web page.
Learning to use inline, internal, and external styles effectively is essential for creating visually appealing and
professional-looking websites.
HTML5ANDCSS3 | [Link] 33
<html>
CHAPTER 010 / HTML TEXT AND LINKS
HTML Text Formatting allows you to enhance and style text to emphasize meaning, highlight
important parts, and improve readability.
It combines basic formatting tags with semantic and accessible design to make content look more
professional and meaningful.
For example, you can make text bold, italic, underlined, marked, or smaller to draw attention or clarify
meaning.
HTML5ANDCSS3 | [Link] 34
HTML Text Formatting
<pre> Tag
<pre>
Line 1
Line 2 (Indented)
Line 3
</pre>
Tag
<code>[Link]("Hello World");</code>
HTML5ANDCSS3 | [Link] 35
HTML Text Formatting
Combined Example
Example
Practical Example
HTML5ANDCSS3 | [Link] 36
HTML Text Formatting
Browser Support
Conclusion
HTML Text Formatting helps you create readable, attractive, and accessible web pages.
By combining formatting tags smartly with CSS and semantics, you can emphasize key information while
maintaining a professional look.
HTML5ANDCSS3 | [Link] 37
<html>
CHAPTER 011 / HTML TEXT AND LINKS
HTML provides several tags to display quoted text, citations, and references properly.
These tags give meaning and context to text quotes, making your content more readable and
semantically correct for browsers and search engines.
Blockquote Example
<blockquote>
"The best way to get started is to quit talking and begin doing."
</blockquote>
You can also include the source of the quote using the cite attribute:
Blockquote Example
<blockquote cite="[Link]
"Success is not final; failure is not fatal: It is the courage to continue that counts."
</blockquote>
HTML5ANDCSS3 | [Link] 38
HTML Quotations & Citations
Q Tag Example
<p>Walt Disney once said, <q>The way to get started is to quit talking and begin doing.</q></p>
Cite Example
Abbr Example
HTML5ANDCSS3 | [Link] 39
HTML Quotations & Citations
<address>
Written by <a href="[Link] Doe</a>.<br>
Visit us at:<br>
123 Web Street, HTML City
</address>
Combined Example
<blockquote cite="[Link]
"Life is like riding a bicycle. To keep your balance, you must keep moving."
</blockquote>
<p><cite>Albert Einstein</cite></p>
Displays the quote, cites the author, and attributes the source properly.
Browser Support
Conclusion
HTML quotation and citation tags make your content more semantic, structured, and credible.
They help browsers, readers, and search engines understand the meaning and origin of text, improving SEO
and accessibility of your web pages.
HTML5ANDCSS3 | [Link] 40
<html>
CHAPTER 012 / HTML TEXT AND LINKS
HTML Links
HTML Links allow you to connect one page to another or link to files, images, or external websites.
Links are created using the (anchor) tag, which turns any text or image into a clickable hyperlink.
Basic Example
Explanation
a) External Links
HTML5ANDCSS3 | [Link] 41
HTML Links
b) Internal Links
d) Email Links
e) Phone Links
HTML5ANDCSS3 | [Link] 42
HTML Links
Value Description
<a href="[Link]
<img src="[Link] alt="HT
ML5 Logo" width="120">
</a>
HTML5ANDCSS3 | [Link] 43
HTML Links
<nav>
<a href="#">Home</a> |
<a href="#">About</a> |
<a href="#">Services</a> |
<a href="#">Contact</a>
</nav>
You can change # with your desired path to link these navigation menus.
Browser Support
Conclusion
HTML Links are essential for connecting web pages and building site navigation.
Using the <a> tag properly improves user experience, accessibility, and SEO - making your website easier
to explore and understand.
HTML5ANDCSS3 | [Link] 44
<html>
CHAPTER 013 / HTML TEXT AND LINKS
HTML Email Links allow users to click and open their default email application to send a message
directly.
This is done using the mailto: protocol inside the (anchor) tag.
Basic Example
- Clicking the link opens the default email client with the To: field pre-filled.
- The text between <a> and </a> becomes clickable.
<a href="[Link]
know%20more%20about%20your%20services.">Send Email</a>
HTML5ANDCSS3 | [Link] 45
HTML Email Links
<a href="[Link]
dback">Send Feedback</a>
Clicking this link automatically populates To, CC, BCC, and Subject fields.
Best Practices
- The Email link will only work, when you have default email client is setup in your system.
- Keep the link text descriptive:
Contact Support instead of Click Here.
- Avoid putting sensitive information in the body.
- Test links across different email clients to ensure compatibility.
Browser Support
Conclusion
HTML Email Links ([Link] provide a fast and convenient way for visitors to contact you directly from
your website.
HTML5ANDCSS3 | [Link] 46
HTML Email Links
By adding subject, body, CC, and BCC, you can streamline communication and improve user experience.
HTML5ANDCSS3 | [Link] 47
<html>
CHAPTER 014 / HTML LISTS AND TABLES
HTML Lists
<ul>
<li>HTML Basics</li>
<li>CSS Styling</li>
<li>JavaScript Introduction</li>
</ul>
<ol>
<li>Register an account</li>
<li>Verify your email</li>
<li>Start learning HTML</li>
</ol>
HTML5ANDCSS3 | [Link] 48
HTML Lists
<dl>
<dt>HTML</dt>
<dd>HyperText Markup Language used for web pages.</dd>
<dt>CSS</dt>
<dd>Cascading Style Sheets used for styling HTML.</dd>
</dl>
Nesting Lists
You can create lists inside lists for hierarchical information.
<ul>
<li>Fruits
<ul>
<li>Apple</li>
<li>Banana</li>
</ul>
</li>
<li>Vegetables
<ul>
<li>Carrot</li>
<li>Spinach</li>
</ul>
</li>
</ul>
HTML5ANDCSS3 | [Link] 49
HTML Lists
Best Practices
- Always use <li> inside <ul> or <ol>.
- Use <dl> for definitions, terms, or FAQs.
- Nest lists carefully for clear structure.
- Style lists using CSS for better appearance.
Browser Support
Conclusion
HTML Lists help structure content in bullet points, numbered steps, or definitions.
They improve readability, organization, and the overall user experience on your web pages.
HTML5ANDCSS3 | [Link] 50
<html>
CHAPTER 015 / HTML LISTS AND TABLES
HTML Tables
HTML Tables allow you to display data in a structured, tabular format with rows and columns.
Tables are commonly used for schedules, pricing lists, reports, and any content that requires clear
organization.
<table border="1">
<tr>
<th>Name</th>
<th>Age</th>
<th>City</th>
</tr>
<tr>
<td>Alissha</td>
<td>28</td>
<td>Delhi</td>
</tr>
<tr>
<td>Swapnil</td>
<td>30</td>
<td>Mumbai</td>
</tr>
</table>
HTML5ANDCSS3 | [Link] 51
HTML Tables
Table Example
<table border="1">
<thead>
<tr>
<th>Product</th>
<th>Price</th>
</tr>
</thead>
<tbody>
<tr>
<td>Laptop</td>
<td>$800</td>
</tr>
<tr>
<td>Tablet</td>
<td>$400</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>Total</td>
<td>$1200</td>
</tr>
</tfoot>
</table>
They improve readability, structure, and accessibility, especially when using JavaScript or styling with
CSS.
Adding Captions
The <caption> tag provides a title or description for your table.
Caption Example
<table border="1">
<caption>Monthly Sales Report</caption>
...
</table>
HTML5ANDCSS3 | [Link] 52
HTML Tables
<table border="1">
<tr>
<th rowspan="2">Name</th>
<th colspan="2">Marks</th>
</tr>
<tr>
<th>Math</th>
<th>Science</th>
</tr>
<tr>
<td>Alissha</td>
<td>95</td>
<td>89</td>
</tr>
</table>
HTML5ANDCSS3 | [Link] 53
HTML Tables
<style>
table {
width: 100%;
border-collapse: collapse;
}
th, td {
border: 1px solid #29AB87;
padding: 10px;
text-align: left;
}
th {
background-color: #f3f3f3;
}
tr:nth-child(even) {
background-color: #fafafa;
}
</style>
<table border="1">
<tr>
<th rowspan="2">Name</th>
<th colspan="2">Marks</th>
</tr>
<tr>
<th>Math</th>
<th>Science</th>
</tr>
<tr>
<td>Alissha</td>
<td>95</td>
<td>89</td>
</tr>
</table>
Responsive Tables
Large tables can overflow on small screens.
Use CSS for horizontal scrolling or stacking layout.
HTML5ANDCSS3 | [Link] 54
HTML Tables
[Link]
<div style="overflow-x:auto;">
<table border="1" style="width: 800px;">
<tr><th>Name</th><th>City</th><th>Email</th></tr>
<tr><td>Alissha</td><td>Delhi</td><td>alissha@[Link]</td></tr>
<tr><td>Swapnil</td><td>Mumbai</td><td>swapnil@[Link]</td></tr>
</table>
</div>
Accessibility Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Accessible HTML Table Example</title>
<style>
table {
width: 100%;
border-collapse: collapse;
margin-top: 15px;
}
caption {
caption-side: top;
font-weight: bold;
margin-bottom: 10px;
text-align: left;
color: #29AB87;
}
th, td {
border: 1px solid #ccc;
padding: 10px;
text-align: left;
}
th {
background-color: #f5f5f5;
}
tr:nth-child(even) {
background-color: #fafafa;
}
tr:hover {
background-color: #f0f9f6;
HTML5ANDCSS3 | [Link] 55
HTML Tables
}
</style>
</head>
<body>
<table>
<caption>List of Students with Age and City</caption>
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Age</th>
<th scope="col">City</th>
</tr>
</thead>
<tbody>
<tr>
<td>Alissha</td>
<td>28</td>
<td>Delhi</td>
</tr>
<tr>
<td>Swapnil</td>
<td>30</td>
<td>Mumbai</td>
</tr>
<tr>
<td>Rahul</td>
<td>26</td>
<td>Pune</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="3">Total Students: 3</td>
</tr>
</tfoot>
</table>
</body>
</html>
Explanation:
HTML5ANDCSS3 | [Link] 56
HTML Tables
Browser Support
Conclusion
HTML Tables provide a powerful way to display and organize data in rows and columns.
Using <thead>, <tbody>, <tfoot>, and CSS styling helps make your tables more structured,
accessible, and responsive.
HTML5ANDCSS3 | [Link] 57
<html>
CHAPTER 016 / HTML LISTS AND TABLES
HTML tables look plain by default - but with a few CSS properties, you can turn them into clean,
professional, and visually appealing data tables.
This chapter will show you how to add borders, colors, spacing, hover effects, and full styling control
over your tables.
Default Table
<table>
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>Alissha</td>
<td>28</td>
</tr>
</table>
<table border="1">
<tr><th>Name</th><th>Age</th></tr>
<tr><td>Alissha</td><td>28</td></tr>
</table>
HTML5ANDCSS3 | [Link] 58
Table Styling & Borders
<style>
table, th, td {
border: 1px solid black;
}
</style>
<table>
<tr><th>Name</th><th>Age</th></tr>
<tr><td>Alissha</td><td>28</td></tr>
</table>
Explanation:
HTML5ANDCSS3 | [Link] 59
Table Styling & Borders
<style>
table {
border-collapse: collapse;
width: 60%;
}
th, td {
border: 1px solid #29AB87;
padding: 8px;
text-align: left;
}
</style>
<table>
<tr><th>Name</th><th>Age</th></tr>
<tr><td>Swapnil</td><td>30</td></tr>
<tr><td>Alissha</td><td>28</td></tr>
</table>
th, td {
padding: 10px;
}
table {
border-spacing: 5px;
}
Tip: border-collapse: collapse; removes cell spacing, while border-spacing adds it.
HTML5ANDCSS3 | [Link] 60
Table Styling & Borders
<style>
th {
background-color: #29AB87;
color: white;
}
td {
background-color: #f9f9f9;
}
</style>
Output:
<style>
tr:hover {
background-color: #eafaf3;
}
</style>
Aligning Text
You can align text left, center, or right using text-align.
HTML5ANDCSS3 | [Link] 61
Table Styling & Borders
Align Example
th {
text-align: center;
}
td {
text-align: right;
}
table {
width: 100%;
height: auto;
}
table {
margin-left: auto;
margin-right: auto;
}
Table Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML Table Styling Example</title>
<style>
table {
width: 80%;
border-collapse: collapse;
margin: 20px auto;
font-family: Arial, sans-serif;
}
HTML5ANDCSS3 | [Link] 62
Table Styling & Borders
caption {
caption-side: top;
font-weight: bold;
margin-bottom: 10px;
color: #29AB87;
}
th, td {
border: 1px solid #ddd;
padding: 10px 15px;
text-align: left;
}
th {
background-color: #29AB87;
color: #fff;
}
tr:nth-child(even) {
background-color: #f9f9f9;
}
tr:hover {
background-color: #e6f5ef;
}
</style>
</head>
<body>
</body>
</html>
HTML5ANDCSS3 | [Link] 63
Table Styling & Borders
- A centered table with borders, background colors, zebra stripes, and hover effects.
- Beautiful readability and professional structure.
Responsive Table
<div style="overflow-x:auto;">
<table> ... </table>
</div>
This ensures that your table does not break layout on mobile devices.
Browser Support
Conclusion
HTML tables become visually appealing with just a few CSS rules.
By adding borders, colors, padding, and hover effects, you make your tables cleaner, more readable,
and mobile-friendly.
Remember: always use CSS for styling, not old HTML attributes.
HTML5ANDCSS3 | [Link] 64
<html>
CHAPTER 017 / HTML IMAGES AND MEDIA
HTML Images
Images make a webpage more engaging and visually appealing. HTML allows you to display
images using the <img> tag, which is an empty tag (it doesn't have a closing tag). You can insert
photos, illustrations, icons, and other graphics directly into your webpage.
Explanation:
Image Example
Tip: It's better to control image size with CSS for responsive design.
HTML5ANDCSS3 | [Link] 65
HTML Images
Image as a Link
You can make an image clickable by placing it inside an <a> tag:
Image as a Link
<a href="[Link]
<img src="[Link] alt="HT
ML5 & CSS3 Logo" width="150">
</a>
HTML5ANDCSS3 | [Link] 66
HTML Images
- SEO optimization
- Screen readers for visually impaired users
- Displaying fallback text when the image is missing
HTML5ANDCSS3 | [Link] 67
HTML Images
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTML Image Example</title>
</head>
<body>
</body>
</html>
Best Practices
- Use <img> tag with src and alt attributes.
- Use width, height, and CSS for responsive styling.
- Wrap images in <a> tags for clickable images.
- Always include descriptive alt text for accessibility.
Browser Support
Conclusion
Images are an essential part of modern web design. They help communicate ideas, showcase products, and
enhance the visual appeal of your website. In HTML, the <img> tag is simple yet powerful - allowing you to
insert, resize, and link images effortlessly.
By combining proper attributes (src, alt, width, height) and modern CSS styling, you can create
responsive, accessible, and fast-loading visuals that improve both user experience and SEO performance.
HTML5ANDCSS3 | [Link] 68
<html>
CHAPTER 018 / HTML IMAGES AND MEDIA
The <picture> element in HTML is used to display responsive images that automatically adjust to
different devices and screen sizes. It allows you to define multiple image sources, and the browser
chooses the most suitable one based on screen width, resolution, or file type.
This helps improve loading speed and visual quality, especially on mobile and high-resolution
displays.
<picture>
<source srcset="[Link] media="(min-width: 800px)">
<source srcset="[Link] media="(min-width: 500px)">
<img src="[Link] alt="A scenic mountain view">
</picture>
Explanation
HTML5ANDCSS3 | [Link] 69
HTML Picture Element
<picture>
<source srcset="[Link] type="image/webp">
<source srcset="[Link] type="image/jpeg">
<img src="[Link] alt="Beautiful landscape">
</picture>
In this example:
Advantages
- Displays the best image for the user's device.
- Reduces bandwidth and improves loading speed.
- Provides flexibility for responsive design.
- Maintains backward compatibility with older browsers.
Browser Support
All modern browsers including Chrome, Firefox, Safari, Edge, and Opera support the <picture> element.
Older browsers that don't support it will still display the fallback <img> tag.
Conclusion
The <picture> element is a powerful tool for delivering responsive and optimized images on the web.
By using it with the srcset, media, and type attributes, you can control how images appear across
different devices, ensuring both speed and quality.
It's an essential part of modern HTML for performance-focused websites.
HTML5ANDCSS3 | [Link] 70
<html>
CHAPTER 019 / HTML IMAGES AND MEDIA
HTML Audio
HTML allows you to add audio content directly to web pages using the <audio> element. You can
embed music, podcasts, sound effects, or any audio file without relying on third-party plugins. The
<audio> element supports multiple audio formats, offers controls, and can play automatically or loop
based on your settings.
Audio Example
<audio controls>
<source src="[Link] type="audio/mpeg">
<source src="[Link] type="audio/ogg">
Your browser does not support the audio element.
</audio>
Explanation
Attributes of <audio>
- controls: Shows audio player controls.
- autoplay: Starts playing automatically when the page loads.
- loop: Replays audio continuously.
- muted: Starts audio in a muted state.
- preload: Specifies whether to load audio data (auto, metadata, none).
HTML5ANDCSS3 | [Link] 71
HTML Audio
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTML Audio Example</title>
</head>
<body>
<p>Enjoy the music directly from your browser without any plugins!</p>
</body>
</html>
HTML5ANDCSS3 | [Link] 72
HTML Audio
Advantages
Browser Support
Conclusion
The HTML <audio> element makes adding sound to your website simple and efficient.
By using multiple sources and the built-in controls, you can ensure your audio plays seamlessly across all
modern browsers. Whether it's background music, podcasts, or alerts, <audio> enhances the user
experience without extra plugins.
HTML5ANDCSS3 | [Link] 73
<html>
CHAPTER 020 / HTML IMAGES AND MEDIA
HTML Video
The HTML <video> element allows you to embed videos directly on web pages without relying on
external plugins. You can display movies, tutorials, animations, or any video content. <video>
supports multiple formats, provides built-in controls, and can autoplay, loop, or be muted for a better
user experience.
<video controls>
<source src="[Link] type="video/m
p4">
<source src="[Link] type="video/
webm">
Your browser does not support the video tag.
</video>
Explanation
Attributes of <video>
- controls: Shows video controls.
- autoplay: Starts playing automatically when the page loads.
- loop: Plays video repeatedly.
- muted: Mutes the video initially.
- poster: Displays an image before the video starts.
- width / height: Sets the size of the video player.
HTML5ANDCSS3 | [Link] 74
HTML Video
Tip: Provide multiple formats to ensure all browsers can play your video.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTML Video Example</title>
</head>
<body>
</body>
</html>
HTML5ANDCSS3 | [Link] 75
HTML Video
Advantages
- Embed videos without third-party plugins.
- Cross-browser support with multiple source formats.
- Customizable playback with attributes like controls, autoplay, loop, and poster.
- Enhances engagement and user experience on your website.
Browser Support
Conclusion
The HTML <video> element allows seamless video integration for websites.
Using multiple formats, the controls attribute, and optional features like poster and autoplay ensures
your content is accessible, engaging, and compatible across modern browsers.
Videos make your web pages dynamic, interactive, and professional, all without additional plugins.
HTML5ANDCSS3 | [Link] 76
<html>
CHAPTER 021 / HTML IMAGES AND MEDIA
HTML provides the <embed> and <object> elements to include external content in web pages, such
as PDFs, multimedia files, or interactive applications. These elements allow you to integrate
non-HTML content seamlessly, giving your website rich functionality beyond standard images,
audio, or video.
Syntax
Explanation:
HTML5ANDCSS3 | [Link] 77
HTML Embed & Object
Attribute Description
Explanation:
HTML5ANDCSS3 | [Link] 78
HTML Embed & Object
Attribute Description
Tip: Use <object> if you want fallback content or additional HTML inside the element. Use <embed> for
simple embedding.
HTML5ANDCSS3 | [Link] 79
HTML Embed & Object
<embed src="[Link]
rollbar=0" type="application/pdf" width="600" height="500">
<object data="[Link]
scrollbar=0" type="application/pdf" width="600" height="500">
<p>Your browser cannot display this PDF. <a href="[Link]
mples/[Link]">Download PDF</a></p>
</object>
Explanation:
- You can control the display of PDF toolbars, navigation panels, and scrollbars by appending
parameters in the URL (#toolbar=0&navpanes=0&scrollbar=0).
- The <object> fallback allows users to download the file if it cannot be displayed.
Note: Some PDF viewers ignore certain parameters depending on the browser or plugin.
Advantages
- Embed multimedia, PDFs, or interactive content directly.
- <object> allows fallback HTML content.
- Both elements work across modern browsers for supported formats.
- Improves user experience without redirecting to external files.
HTML5ANDCSS3 | [Link] 80
HTML Embed & Object
Browser Support
Conclusion
The <embed> and <object> elements can display supported external resources such as PDFs.
<object> is useful when fallback HTML is required. Prefer dedicated HTML elements for audio, video,
images, and webpages.
HTML5ANDCSS3 | [Link] 81
<html>
CHAPTER 022 / HTML FORMS
HTML forms are essential for collecting user input on a website. They allow users to enter
information like names, email addresses, passwords, or upload files. These inputs can then be sent
to a server for processing, such as logging in, signing up, or submitting feedback.
Basic Syntax
An HTML form is created using the <form> element, which wraps around input fields, buttons, and other
controls.
Forms Syntax
<label for="email">Email:</label>
<input type="email" id="email" name="useremail" required>
Explanation
HTML5ANDCSS3 | [Link] 82
HTML Forms Overview
Element Description
<label for="message">Message:</label>
<textarea id="message" name="message"></textarea><br><br>
<label for="gender">Gender:</label>
<select id="gender" name="gender">
<option value="male">Male</option>
<option value="female">Female</option>
</select><br><br>
<button type="submit">Send</button>
</fieldset>
</form>
HTML5ANDCSS3 | [Link] 83
HTML Forms Overview
3. The server processes the input (e.g., saves it, emails it, or validates it).
4. The user receives a response (success or error).
Browser Support
Conclusion
HTML forms are the foundation of user interaction on the web. Whether it's logging in, submitting a
comment, or making a purchase - forms make it possible. As we move ahead, you'll learn about form
elements, input types, attributes, and how to validate user input.
HTML5ANDCSS3 | [Link] 84
<html>
CHAPTER 023 / HTML FORMS
HTML form elements are the building blocks that make up a form. These elements allow users to
interact with a webpage - typing text, selecting options, uploading files, and submitting data. Each
element serves a specific purpose to collect the right type of information.
Element Description
HTML5ANDCSS3 | [Link] 85
HTML Form Elements
Basic Example
<label for="email">Email:</label>
<input type="email" id="email" name="email"><br><br>
<label for="message">Message:</label><br>
<textarea id="message" name="message" rows="4" cols="30"></textarea><br><br>
<button type="submit">Submit</button>
</form>
- <input> - Most commonly used element; supports multiple types like text, password, checkbox,
radio, and file.
- <label> - Clicking the label focuses the input field it's linked to via the for attribute.
- <textarea> - Allows users to write long text.
- <select> and <option> - Used for dropdown lists.
- <button> - More flexible than <input type="submit">; can contain icons or text.
- <fieldset> & <legend> - Visually group related form fields.
- <datalist> - Adds auto-complete suggestions when typing.
HTML5ANDCSS3 | [Link] 86
HTML Form Elements
Form Example
<form oninput="[Link]=parseInt([Link])+parseInt([Link])">
<label for="browser">Choose your browser:</label>
<input list="browsers" id="browser" name="browser">
<datalist id="browsers">
<option value="Chrome">
<option value="Firefox">
<option value="Edge">
<option value="Safari">
</datalist>
<br><br>
Keynotes
- Each form element should have a name attribute so that its value can be sent to the server.
- Use labels for accessibility (especially for screen readers).
- Group related fields using fieldset for clarity and organization.
Browser Support
Conclusion
HTML form elements are the core of web input collection. They define how users provide information, from a
simple text field to complex dropdowns and file uploads. Understanding these elements makes it easier to
design user-friendly and accessible forms.
HTML5ANDCSS3 | [Link] 87
<html>
CHAPTER 024 / HTML FORMS
The <input> element is one of the most versatile and commonly used elements in HTML forms.
It can represent different types of input fields depending on the type attribute.
Each input type provides a specific way to collect and validate user data.
Basic Syntax
The type attribute defines the kind of input. For example, text, email, password, checkbox, and so on.
HTML5ANDCSS3 | [Link] 88
HTML Input Types
<label>Password:</label>
<input type="password" name="password" placeholder="Enter password"><br><br>
<label>Email:</label>
<input type="email" name="email" placeholder="name@[Link]"><br><br>
<label>Telephone:</label>
<input type="tel" name="phone" placeholder="+91 9876543210"><br><br>
<label>Number:</label>
<input type="number" name="age" min="1" max="100"><br><br>
<label>URL:</label>
<input type="url" name="website" placeholder="[Link]
<label>Time:</label>
<input type="time" name="appt"><br><br>
<label>Datetime Local:</label>
<input type="datetime-local" name="meeting"><br><br>
<label>Month:</label>
<input type="month" name="birthmonth"><br><br>
<label>Week:</label>
<input type="week" name="projectweek"><br><br>
HTML5ANDCSS3 | [Link] 89
HTML Input Types
<label>Hobbies:</label>
<input type="checkbox" name="hobby" value="reading"> Reading
<input type="checkbox" name="hobby" value="traveling"> Traveling
<input type="checkbox" name="hobby" value="music"> Music<br><br>
<label>Favorite Color:</label>
<input type="color" name="favcolor"><br><br>
Explanation
- Text-based Inputs - text, password, email, tel, url, number let users enter basic info.
- Date & Time Inputs - date, time, month, week, and datetime-local add native pickers.
- Choice Inputs - checkbox and radio provide selection options.
- File/Color/Range - file uploads, color opens a color picker, range provides a slider.
- Buttons - submit, reset, and button control form actions.
- Hidden - Stores background data like user IDs or tokens.
Key Notes
HTML5ANDCSS3 | [Link] 90
HTML Input Types
Browser Support
Conclusion
HTML input types determine what kind of data can be entered and how browsers validate it.
By using appropriate input types, you make forms more intuitive, secure, and user-friendly.
Next, we'll explore HTML Input Attributes - which define how these input types behave and interact.
HTML5ANDCSS3 | [Link] 91
<html>
CHAPTER 025 / HTML FORMS
HTML <input> elements support a wide range of attributes that define their behavior, appearance,
and interaction with users. These attributes help control data entry, validation, accessibility, and
styling within web forms.
HTML5ANDCSS3 | [Link] 92
HTML Input Attributes
HTML5ANDCSS3 | [Link] 93
HTML Input Attributes
HTML5ANDCSS3 | [Link] 94
HTML Input Attributes
HTML5ANDCSS3 | [Link] 95
HTML Input Attributes
HTML5ANDCSS3 | [Link] 96
HTML Input Attributes
<form>
<label>Username:</label>
<input type="text" name="username" placeholder="Enter your name" required minlength="3" maxleng
th="15"><br><br>
<label>Email:</label>
<input type="email" name="email" autocomplete="on" required><br><br>
<label>Password:</label>
<input type="password" name="password" minlength="6" maxlength="12" required><br><br>
<label>Age:</label>
<input type="number" min="18" max="100" step="1"><br><br>
<label>Gender:</label>
<input type="radio" name="gender" value="male" checked> Male
<input type="radio" name="gender" value="female"> Female<br><br>
<label>Favorite Browser:</label>
<input list="browsers">
<datalist id="browsers">
<option value="Chrome">
<option value="Firefox">
<option value="Edge">
<option value="Safari">
</datalist><br><br>
<label>Upload Files:</label>
<input type="file" multiple><br><br>
HTML5ANDCSS3 | [Link] 97
HTML Input Attributes
Browser Support
Conclusion
HTML input attributes enhance the functionality, usability, and validation of web forms. By combining these
attributes effectively, developers can create user-friendly, secure, and accessible input fields.
HTML5ANDCSS3 | [Link] 98
<html>
CHAPTER 026 / HTML FORMS
HTML <form> elements contain several attributes that define how form data is collected, processed,
and submitted. These attributes control important aspects such as where and how the data is sent,
how it is encoded, and how the form behaves during submission.
<form action="submit_form.php">
<input type="text" name="username">
<input type="submit">
</form>
If the action attribute is omitted, the form submits to the same page it's currently on.
HTML5ANDCSS3 | [Link] 99
HTML Form Attributes
Value Description
Value Description
<form autocomplete="off">
<input type="text" name="name" placeholder="Full name">
<input type="email" name="email" placeholder="Email address">
<input type="submit">
</form>
<form name="registrationForm">
<input type="text" name="username">
<input type="submit">
</form>
<label>Full Name:</label>
<input type="text" name="fullname" required><br><br>
<label>Email:</label>
<input type="email" name="email" required><br><br>
<label>Profile Picture:</label>
<input type="file" name="profile_pic"><br><br>
<label>Message:</label><br>
<textarea name="message" rows="4" cols="30"></textarea><br><br>
Browser Support
Conclusion
HTML form attributes define how form data is sent and processed.
By understanding and combining attributes like action, method, enctype, and target, developers can
control form behavior precisely and build robust user input systems.
Form validation ensures that the data entered by a user meets the expected format and
requirements before being submitted to the server. It helps maintain data accuracy, prevent errors,
and enhance user experience.
HTML5 introduced built-in form validation features that work without the need for JavaScript.
HTML5's client-side validation is fast and prevents invalid data from being sent.
Required Example
<form>
<label>Email:</label>
<input type="email" name="email" required>
<input type="submit" value="Submit">
</form>
If the user tries to submit without filling the field, the browser shows an error message.
Pattern Example
<form>
<label>Username (letters only):</label>
<input type="text" name="username" pattern="[A-Za-z]+" required>
<input type="submit" value="Submit">
</form>
<form>
<label>Age (18-60):</label>
<input type="number" name="age" min="18" max="60" required>
<input type="submit" value="Submit">
</form>
Step Example
<form>
<label>Enter number (increments of 5):</label>
<input type="number" name="quantity" step="5">
<input type="submit">
</form>
Type Example
<form>
<label>Email:</label>
<input type="email" name="email" required><br><br>
<label>Website:</label>
<input type="url" name="website" required><br><br>
<input type="submit">
</form>
If the entered text is not a valid email or URL, the browser displays an error.
Novalidate Example
<form novalidate>
<input type="email" name="email" placeholder="Enter email">
<input type="submit">
</form>
This is useful for testing or when you want to handle validation using JavaScript.
<form>
<label>Username:</label>
<input type="text" name="username" pattern="[A-Za-z]+" title="Only letters are allowed">
<input type="submit">
</form>
Example
<label>Email:</label>
<input type="email" name="email" required><br><br>
<label>Age (18-60):</label>
<input type="number" name="age" min="18" max="60" required><br><br>
<label>Password:</label>
<input type="password" name="password" minlength="6" maxlength="12" required><br><br>
<label>Website:</label>
<input type="url" name="website" required><br><br>
If the user leaves any required field blank or enters invalid data, the browser automatically prevents
submission and shows relevant hints.
Browser Support
Conclusion
HTML form validation is a powerful feature that improves data accuracy and user experience without extra
JavaScript.
Using attributes like required, pattern, min, max, and input types such as email or url, you can easily
ensure correct and complete data entry.
<div>, <p>, <h1>-<h6>, <ul>, <ol>, <li>, <section>, <article>, <header>, <footer>, <form>,
<table>
Rendered Output:
Rendered Output:
Combined Example
Explanation:
Converting Example
Explanation:
- The <span> is normally inline, but CSS display: block makes it behave like a block.
- The <div> is normally block, but display: inline makes it sit inline with text.
Browser Support
Conclusion
Block-level and inline elements form the foundation of HTML page structure.
Mastering their behavior is the first step toward understanding modern HTML layout design.
The <div> and elements are two of the most commonly used tags in HTML.
They do not add any visual change by themselves but are extremely useful for grouping content,
styling, and layout control using CSS.
Introduction
Both <div> and <span> are container elements:
They are often used with CSS or JavaScript to structure and style specific parts of a web page.
Div Syntax
Div Example
Explanation:
Div Example
The Element
The <span> tag is used to group inline elements for styling or scripting purposes.
Unlike <div>, it does not start a new line and only takes up the width of its content.
Span Syntax
Span Example
Explanation:
Combined Example
Explanation:
<style>
.box { background: lightgray; padding: 10px; margin: 5px; }
.highlight { color: green; font-weight: bold; }
</style>
<div class="box">
<p>This is a <span class="highlight">highlighted</span> word inside a div.</p>
</div>
Explanation:
Practical Example
Explanation:
This structure allows easy styling and layout control. Each <span> can be customized independently.
Browser Support
Conclusion
- The <div> element is used for structuring and organizing large sections of content.
- The <span> element is used for styling and targeting specific parts of inline text.
- Together, they form the building blocks of modern web layouts, especially when combined with
CSS and JavaScript.
In modern web design, creating a clear and meaningful page structure is essential. Semantic layout
tags in HTML help you define different parts of a webpage with meaningful names.
They make your code easier to read, maintain, and improve accessibility for both users and search
engines.
Before HTML5, developers commonly used <div> elements everywhere, giving them IDs or classes like
header, footer, or content.
Now, HTML5 introduces semantic elements that describe their purpose directly - no extra naming required!
Tag Description
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Semantic Layout Example</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
}
header, nav, main, aside, footer {
padding: 20px;
margin: 10px;
border-radius: 8px;
}
header { background: #4CAF50; color: white; }
nav { background: #f1f1f1; }
main { background: #fff; }
aside { background: #f9f9f9; }
footer { background: #333; color: white; text-align: center; }
</style>
</head>
<body>
<header>
<h1>My Website</h1>
<p>Welcome to my homepage</p>
</header>
<nav>
<a href="#">Home</a> |
<a href="#">About</a> |
<a href="#">Services</a> |
<a href="#">Contact</a>
</nav>
<main>
<article>
<h2>What is HTML5?</h2>
<p>HTML5 introduces semantic elements that make web pages more readable and structured.</p>
</article>
<section>
<h2>Why Use Semantic Tags?</h2>
<p>They help browsers, developers, and search engines understand the meaning of your conten
t.</p>
</section>
</main>
<aside>
<h3>Related Links</h3>
<ul>
<li><a href="#">Learn HTML</a></li>
<li><a href="#">CSS Basics</a></li>
</ul>
</aside>
<footer>
<p>(c) 2025 My Website | All rights reserved.</p>
</footer>
</body>
</html>
Browser Support
Conclusion
Semantic layout tags bring structure and meaning to your webpage.
By using them instead of generic <div> tags, you create web pages that are cleaner, more accessible, and
optimized for search engines.
HTML Iframes
An iframe (short for inline frame) is an HTML element that allows you to embed another webpage or
document inside the current webpage. It acts like a window or a mini browser within your page.
Iframe Syntax
[Link]
Iframe Attributes:
<iframe src="[Link]"
height Sets the height of the iframe.
height="400"></iframe>
<iframe src="[Link]"
width Sets the width of the iframe.
width="600"></iframe>
<iframe src="[Link]"
title Provides a title for accessibility.
title="Demo"></iframe>
[Link]
[Link]
[Link]
<!--Default sandbox value is restricted to submit any form or script. To submit the form you need
to allow it with sandbox. Try using sandbox="allow-forms" and it will let you submit the form. -
->
This prevents the embedded page from running scripts or submitting forms - improving security.
[Link]
When you click the link, it loads inside the iframe instead of opening a new page.
Browser Support
In HTML, certain characters like <, >, &, or " have special meanings and cannot be written directly
inside the document - doing so can confuse the browser.
To display these characters properly, we use HTML entities.
An HTML entity is a code that begins with an ampersand (&) and ends with a semicolon (;).
They are used to represent characters that are either reserved in HTML or not available on a standard
keyboard.
Syntax
[Link]
&entity_name;
OR
&#entity_number;
Example
[Link]
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTML Entities Example</title>
</head>
<body>
<h2>HTML Entities Demo</h2>
<p>5 < 10 and 10 > 5</p>
<p>Copyright © 2025 HTML5 & CSS3</p>
<p>Price: 500 </p>
<p>Symbols: ♥ ☆ ✓ ™</p>
</body>
</html>
∞ Infinity
Browser Support
Conclusion
HTML entities and symbols make your web pages look professional and readable while maintaining correct
HTML syntax.
They're especially useful in displaying currency, mathematics, special characters, and even icons in a clean
and browser-safe way.
HTML Emojis
Syntax
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTML Emojis</title>
</head>
<body>
<h2>Using Emojis in HTML</h2>
<p>I love HTML and CSS !</p>
<p>Learning is fun </p>
</body>
</html>
Output:
[Link]
<p>Smile: </p>
<p>Heart: </p>
<p>Star: </p>
<p>Rocket: </p>
Grinning Face
Heart Eyes
Cool Face
Crying Face
Angry Face
Red Heart
Star
Fire
Rocket
Earth Globe
Check Mark
Light Bulb
Telephone
Important Notes
- Always include <meta charset="UTF-8"> in your <head> section - this ensures emojis display
correctly.
- Emojis render differently on Windows, macOS, Android, and iOS, depending on the system font.
- You can also use CSS font-family to control emoji style slightly (e.g., font-family: Segoe UI
Emoji;).
[Link]
Browser Support
Conclusion
Emojis make web pages more expressive and user-friendly.
With HTML and Unicode, you can easily add thousands of emojis without relying on images - making your
design lighter, modern, and fun.
The <head> element in HTML contains metadata - information about the web page that is not
visible directly on the browser screen but is essential for SEO, browser behavior, linking styles, and
scripts.
Everything inside the <head> helps define how your webpage is displayed and behaves.
Basic Syntax
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<title>My Web Page</title>
<meta charset="UTF-8">
<meta name="description" content="Learn HTML Head Elements">
<meta name="keywords" content="HTML, CSS, JavaScript">
<meta name="author" content="Your Name">
<link rel="stylesheet" href="[Link]">
<script src="[Link]"></script>
</head>
<body>
<h1>Welcome to My Web Page</h1>
</body>
</html>
Character Encoding
[Link]
<meta charset="UTF-8">
[Link]
SEO Metadata
[Link]
[Link]
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Learn all HTML Head Tags with examples">
<meta name="keywords" content="HTML, Head, Meta, SEO, CSS">
<meta name="author" content="HTML5 & CSS3">
<title>HTML Head Tags Tutorial</title>
<link rel="stylesheet" href="[Link]">
<link rel="icon" href="[Link]">
<script src="[Link]"></script>
</head>
<body>
<h1>Welcome to the HTML Head Tags Tutorial</h1>
</body>
</html>
Browser Support
Conclusion
The <head> section is the control center of your HTML document.
It tells browsers, search engines, and users' devices how to interpret your page, making it a critical part of
every web project.
Meta tags are snippets of text placed inside the <head> section of an HTML document.
They provide metadata about your web page to search engines, browsers, and social media
platforms.
While meta tags aren't visible to users, they play a major role in SEO (Search Engine Optimization),
social sharing, and page indexing.
Basic Syntax
[Link]
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML Meta Tags for SEO</title>
<meta name="description" content="Learn how to use HTML meta tags to improve your website SEO,
visibility, and click-through rate.">
<meta name="keywords" content="HTML, meta tags, SEO, description, keywords">
<meta name="author" content="HTML5 & CSS3">
Meta Description
[Link]
<meta name="description" content="A short summary about your web page for search results.">
Example:
[Link]
<meta name="description" content="Learn HTML and CSS with practical examples and hands-on tutoria
ls.">
[Link]
Note: Most modern search engines (like Google) ignore this tag, but some smaller or custom engines may
still use it.
Meta Author
[Link]
Defines who created the page - good for credit or corporate branding.
[Link]
Ensures your page scales correctly on all devices - a must for mobile-friendly SEO.
Meta Robots
[Link]
Example:
[Link]
[Link]
Used by Facebook, LinkedIn, and Twitter to show rich previews when sharing links.
[Link]
Meta Charset
[Link]
<meta charset="UTF-8">
[Link]
Canonical Tag
[Link]
Prevents duplicate content issues and tells search engines the preferred version of a page.
Browser Support
Conclusion
Meta tags are the invisible backbone of SEO - they tell search engines what your page is about, how it
should appear, and how it interacts with other platforms.
Proper use of meta tags boosts your site's visibility, ranking, and user engagement.
Responsive web design is a crucial concept in modern web development. It ensures that a website
looks and works well on all devices - from large desktop monitors to small mobile screens.
Key Goals:
This tag tells browsers how to control the page's dimensions and scaling.
[Link]
Explanation:
- width=device-width: sets the page width to match the device screen width.
- initial-scale=1.0: sets the initial zoom level when the page is loaded.
Using Percentages
[Link]
<style>
.container {
width: 90%;
margin: auto;
}
</style>
[Link]
<style>
.flex-container {
display: flex;
flex-wrap: wrap;
}
.box {
flex: 1 1 300px;
margin: 10px;
background: lightblue;
}
</style>
<div class="flex-container">
<div class="box">Box 1</div>
<div class="box">Box 2</div>
<div class="box">Box 3</div>
</div>
Media queries allow styles to change depending on device characteristics (like screen width).
[Link]
<style>
body {
background-color: lightblue;
}
Explanation:
When the screen width is 600px or less, the background color changes to lightcoral.
Responsive Images
Using max-width
[Link]
<style>
img {
max-width: 100%;
height: auto;
}
</style>
[Link]
<picture>
<source srcset="[Link]" media="(min-width: 800px)">
<source srcset="[Link]" media="(max-width: 799px)">
<img src="[Link]" alt="Responsive image">
</picture>
Responsive Text
[Link]
<style>
h1 {
font-size: 5vw; /* 5% of viewport width */
}
</style>
- Bootstrap
- Tailwind CSS
- Foundation
[Link]
<div class="container">
<div class="row">
<div class="col-md-6">Left</div>
<div class="col-md-6">Right</div>
</div>
</div>
Best Practices
- Always use the viewport meta tag.
- Test your layout on multiple devices and orientations.
- Avoid fixed-width elements.
- Use flexible grid systems and relative units.
- Optimize images for mobile screens.
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Responsive Webpage Example</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
header, footer {
background-color: #29AB87;
color: white;
text-align: center;
padding: 15px;
}
.container {
display: flex;
flex-wrap: wrap;
padding: 20px;
gap: 10px;
}
.box {
flex: 1 1 300px;
background-color: #f4f4f4;
padding: 20px;
border-radius: 8px;
text-align: center;
}
img {
max-width: 100%;
height: auto;
border-radius: 6px;
}
@media (max-width: 768px) {
header, footer {
font-size: 16px;
padding: 10px;
}
}
</style>
</head>
<body>
<header>
<h2>HTML Responsive Design Example</h2>
</header>
<div class="container">
<div class="box">
<h3>Flexible Layout</h3>
<p>The layout automatically adjusts to fit the screen size.</p>
</div>
<div class="box">
<h3>Responsive Image</h3>
<img src="[Link] alt="Nature Image">
</div>
<div class="box">
<h3>Media Queries</h3>
<p>Media queries help to apply styles for different screen widths.</p>
</div>
</div>
<footer>
© 2025 HTML5 & CSS3 - Responsive Design Demo
</footer>
</body>
</html>
Try resizing your browser - the layout and image will adjust automatically.
Summary Table
Concept Description
Browser Support
HTML5 introduced several new tags to improve semantic meaning, multimedia handling, and web
structure.
These tags make the code more readable and help search engines and assistive technologies (like
screen readers) understand the content better.
Example:
[Link]
<header>
<h1>Welcome to HTML5</h1>
</header>
<article>
<h2>HTML5 Features</h2>
<p>HTML5 brings new structure and multimedia tags for modern web development.</p>
</article>
<footer>
<p>© 2025 HTML5 & CSS3</p>
</footer>
Tag Description
Multimedia Tags
Tag Description
Example:
[Link]
Tag Description
Example:
[Link]
Tag Description
Example:
[Link]
<details>
<summary>Show Details</summary>
<p>This is additional information that can be toggled open or closed.</p>
</details>
Tag Description
Example:
[Link]
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML5 New Tags Example</title>
</head>
<body>
<header>
<h1>HTML5 Semantic Example</h1>
<nav>
<a href="#home">Home</a> |
<a href="#articles">Articles</a>
</nav>
</header>
<main>
<article id="articles">
<header>
<h2>Understanding HTML5 Tags</h2>
</header>
<p>HTML5 introduced many new elements that improve the structure of web documents.</p>
<figure>
<img src="[Link] alt
="HTML5 Logo" width="150">
<figcaption>HTML5 Logo</figcaption>
</figure>
</article>
<aside>
<h3>Did You Know?</h3>
<p>You can use the <mark><mark></mark> tag to highlight important text!</p>
</aside>
</main>
<footer>
<p>© 2025 HTML5 & CSS3 Tutorials</p>
<time datetime="2025-10-22">October 22, 2025</time>
</footer>
</body>
</html>
Browser Support
Conclusion
HTML5 new tags have made web pages more meaningful, accessible, and organized.
They reduce dependency on <div>-based layouts and improve both user experience and SEO
performance.
Learning and applying these tags is essential for writing modern, professional, and semantic HTML.
Deprecated Tags
As HTML evolved, many tags that were once common became deprecated - meaning they are no
longer recommended for use in modern web development.
Deprecated tags may still work in some browsers for backward compatibility, but they are not
supported in HTML5 and can cause SEO and accessibility issues.
Example (Deprecated):
[Link]
<center>
<h2>This is centered text</h2>
</center>
[Link]
<basefont> Sets default font for a page Use CSS (font-family, font-size)
<font> Sets font size, color, face CSS (font-family, color, font-size)
Deprecated HTML:
[Link]
<body bgcolor="lightblue">
<center>
<font color="red" size="5">Welcome to My Page</font>
</center>
</body>
[Link]
Summary
Concept Description
Browser Support
Conclusion
Deprecated tags are remnants of early HTML versions.
Modern web design emphasizes separation of content and style, achieved through semantic HTML and
CSS.
By avoiding deprecated tags and using current standards, you create websites that are cleaner,
future-proof, and search-friendly.
Global attributes are special attributes that can be used with any HTML element - regardless of the
tag type.
They help define common properties like element identity, accessibility, language, styling, and
custom data.
These attributes make web development more consistent, interactive, and manageable.
Example:
[Link]
hidden Hides the element from display <p hidden>This will not be visible.</p>
[Link]
<style>
.highlight { color: crimson; font-weight: bold; }
</style>
Explanation:
The id uniquely identifies the element, and class applies a reusable style.
b) Using contenteditable
[Link]
Result: You can directly edit the text inside the browser.
[Link]
<script>
const course = [Link]('div').[Link];
[Link]('consoleMessage').innerHTML = course;
</script>
[Link]
Result:
Best Practices
Use class for grouping elements (avoid too many IDs).
Use data-* for storing small bits of data safely.
Avoid overusing inline style - use external CSS instead.
Use lang and dir for multilingual websites.
Always provide meaningful title tooltips.
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Global Attributes Example</title>
<style>
.editable { background-color: #f0f8ff; padding: 10px; }
</style>
</head>
<body>
</body>
</html>
Explanation:
Summary
Concept Description
Browser Support
Conclusion
Global attributes are universal tools in HTML that enhance every element's functionality.
By using them smartly - especially class, data-*, and accessibility attributes - you make your web pages
organized, interactive, and future-proof.
Event Attributes
In short, event attributes connect HTML with JavaScript to make webpages dynamic and interactive.
What is an Event?
An event is an action that happens in the browser - triggered by the user or the browser itself.
Examples of events:
Basic Syntax
[Link]
Example:
[Link]
When the user clicks this button, an alert box will pop up.
<button
onclick Triggered when an element is clicked
onclick="myFunction()">Click</button>
<div
Triggered when the mouse pointer
onmouseover onmouseover="highlight()">Hover</div
hovers over an element
>
<div
Triggered when the mouse pointer
onmouseout onmouseout="removeHighlight()">Mov
leaves the element
e out</div>
<form onsubmit="return
onsubmit Triggered when a form is submitted
validateForm()">
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Event Example</title>
<script>
function showMessage() {
alert("You clicked the button!");
}
</script>
</head>
<body>
<button onclick="showMessage()">Click Me</button>
</body>
</html>
[Link]
<script>
function validateForm() {
let name = [Link]('name').value;
if (name === "") {
alert("Please enter your name!");
return false;
}
alert("Form submitted successfully!");
return true;
}
</script>
[Link]
<div onmouseover="[Link]='lightgreen'"
onmouseout="[Link]='white'"
style="width:200px; height:100px; border:1px solid gray; text-align:center; line-height:100p
x;">
Hover over me!
</div>
Event Categories
Category Examples
Best Practice
While you can write JavaScript inside HTML event attributes, it's better to separate JavaScript from HTML
for cleaner, maintainable code.
[Link]
<script>
[Link]("clickBtn").onclick = function() {
alert("Hello, World!");
};
</script>
Mouse Events
Keyboard Events
Form Events
Clipboard Events
Miscellaneous Events
Browser Support
Conclusion
Event attributes are essential for connecting HTML with JavaScript.
Understanding them enables you to build interactive, responsive, and dynamic web pages that respond to
user actions and system changes effectively.
Below is a categorized reference to the HTML elements covered in this tutorial, including commonly
used, semantic, media, form, and scripting elements.
Tag Description
Metadata Tags
Tag Description
Tag Description
Tag Description
Tag Description
List Tags
Tag Description
Tag Description
Table Tags
Tag Description
Tag Description
Tag Description
Tag Description
Tag Description
Tag Reason
Browser Support
Conclusion
This reference provides a broad overview of the HTML elements covered in this tutorial, categorized for
easy learning.
Understanding these elements will help you structure webpages semantically and improve accessibility,
SEO, and maintainability.
HTML5 made everyday markup more expressive. It gave familiar parts of a webpage meaningful
names and added native tools for media, forms, and interactive interfaces.
HTML5 made everyday markup more expressive. It gave familiar parts of a webpage meaningful
names and added native tools for media, forms, and interactive interfaces.
Use this page as a quick reference. Select any tag to open its lesson, where you'll find the syntax, practical
examples, browser notes, and guidance on when to use it.
The <!DOCTYPE> declaration defines the document type and version of HTML that the page is
written in.
It helps browsers render the page correctly according to HTML standards.
Syntax
[Link]
<!DOCTYPE html>
- The declaration must appear at the very top of an HTML document, before the <html> tag.
- It is not case-sensitive (<!doctype html> also works).
- It does not have a closing tag.
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>My First HTML Page</title>
</head>
<body>
<h1>Welcome to My Website</h1>
<p>This page uses HTML5 declaration.</p>
</body>
</html>
Browser Support
There is no visible effect of <!DOCTYPE> on the page itself - it only affects how the browser interprets the
HTML.
Notes
- In HTML5, <!DOCTYPE html> is simple and universal for all browsers.
- In older versions of HTML, doctypes were longer and more complex, e.g.:
[Link]
- Using the HTML5 doctype ensures your page is rendered in standards mode, not quirks mode
(which can cause inconsistent behavior).
Conclusion
The <!DOCTYPE html> declaration is a small but essential part of every HTML document.
It tells browsers to use the latest HTML5 standards, ensuring consistent display and functionality across all
browsers.
Always include it at the top of your HTML files to avoid rendering issues and maintain proper page structure.
It defines the start and end of an HTML document and can include a lang attribute to specify the
language of the content.
Syntax
[Link]
<html lang="en">
<!-- All other HTML content goes here -->
</html>
- lang="en" sets the language to English (recommended for accessibility and SEO).
- Must enclose both <head> and <body> tags.
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<title>HTML Root Example</title>
</head>
<body>
<h1>Welcome to My Website</h1>
<p>This content is inside the <html> root element.</p>
</body>
</html>
Browser Support
All content on the page is contained within the <html> element, though this container is not visibly shown
in the browser.
Notes
- Always use <html> as the first element after <!DOCTYPE>.
- Including the lang attribute improves accessibility for screen readers and helps search engines
understand your content.
- Closing tag </html> is mandatory in HTML5.
- Other global attributes (like dir="ltr" for text direction) can also be added.
Conclusion
The <html> tag is the foundation of every HTML document, acting as a container for all content.
Using it properly ensures your page is structured correctly, accessible, and compatible with browsers and
search engines.
Always pair it with <!DOCTYPE html> at the very top of your document for full HTML5 compliance.
The <head> tag contains metadata and information about the document that is not directly
displayed on the web page.
It usually includes the page title, links to CSS stylesheets, JavaScript files, meta descriptions, and
other resources used by browsers and search engines.
Everything inside the <head> helps define how the page behaves, not how it looks.
Syntax
[Link]
<head>
<!-- Metadata and external resources go here -->
</head>
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<title>HTML Head Example</title>
<meta charset="UTF-8">
<meta name="description" content="An example of using the head tag in HTML.">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="[Link]">
</head>
<body>
<h1>Welcome!</h1>
<p>This page uses metadata and linked CSS inside the <head> section.</p>
</body>
</html>
Browser Support
None of the <head> content is visible - it only influences page behavior and metadata.
Notes
- The <head> element must appear before the <body> in every HTML document.
- Typical elements inside <head> include:
<ul class="wp-block-list">
<li><title> - sets the page title.</li>
Conclusion
The <head> tag is the brain of the HTML document, controlling metadata, linking resources, and guiding
browsers and search engines.
Although it's not visible on the page, it's essential for SEO, responsive design, and overall page
performance.
Always include a well-structured <head> section in your HTML documents for proper functionality and
optimization.
Syntax
[Link]
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<title>HTML Title Tag Example</title>
<meta charset="UTF-8">
<meta name="description" content="Example showing how the title tag works in HTML.">
</head>
<body>
<h1>Welcome to My Website</h1>
<p>The page title appears in your browser tab, not on the page.</p>
</body>
</html>
Browser Support
The text "HTML Title Tag Example" appears in the browser tab title.
Notes
- The <title> element is required in every HTML document.
- It must be placed inside the <head> section.
- The title appears in:
<ul class="wp-block-list">
<li>Browser tab</li>
<li>Bookmarks/favorites</li>
Conclusion
The <title> tag is a vital SEO and usability element of any web page.
It defines what users see in their browser tabs and search results.
A well-written title improves click-through rates, page identity, and search engine ranking, making it one
of the most important tags in your HTML document.
The <body> tag defines the main content area of an HTML document. It contains all the elements
that are visible to users on a web page - such as text, images, videos, links, tables, lists, and forms.
Everything that appears in a browser window (excluding metadata) must be placed inside the
<body> tag.
Syntax
[Link]
<body>
<!-- Visible content goes here -->
</body>
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>Body Tag Example</title>
</head>
<body>
<h1>Welcome to My Webpage</h1>
<p>This content is inside the body tag.</p>
<img src="[Link] alt="Sample Image" width="400">
</body>
</html>
Browser Support
The content of <body> tag are visible things and can be displayed in the web browser.
Notes
- Each HTML document can have only one <body> tag.
- All content elements such as headings, paragraphs, lists, links, tables, etc., must be placed inside
the <body>.
- The <body> tag should not contain <head> elements or metadata.
- Inline styling and event attributes (like onload or onresize) can be applied to the <body> tag.
- Without the <body> tag, browsers may render content unpredictably or fail HTML validation.
Conclusion
The <body> tag is a fundamental structural component of any HTML document. It represents the main
section that users see and interact with. Proper use of the <body> tag ensures a well-structured, valid, and
correctly rendered webpage.
The <base> tag specifies the base URL and/or target for all relative URLs in a document.
It defines a reference point so that links and resources (like images, CSS, or JavaScript files)
without absolute URLs are resolved relative to the <base> URL.
Syntax
[Link]
- href: Specifies the base URL for all relative links in the document.
- target: Defines the default target for all hyperlinks (e.g., _blank, _self, _parent, _top).
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>Base Tag Example</title>
<base href="[Link] target="_blank">
</head>
<body>
<a href="learn-html/">Learn HTML</a>
<img src="[Link] alt="Chrome Logo" widt
h="80">
</body>
</html>
Browser Support
Notes
- The <base> tag must be placed inside the <head> section.
- Only one <base> tag is allowed per document.
- If both href and target attributes are used, they affect all relative URLs and hyperlinks in the page.
- To override the default target for specific links, use the target attribute directly on the <a> tag.
- Improper use may cause resource links to break if relative URLs are incorrectly resolved.
Conclusion
The <base> tag helps maintain consistent and predictable link behavior across a website by defining a
single reference point for all relative URLs. It simplifies development when multiple relative resources share
a common base path.
The <link> tag defines the relationship between the current HTML document and an external
resource.
It is most commonly used to link external CSS stylesheets, but can also be used for favicons,
preconnect, alternate languages, and RSS feeds.
Syntax
[Link]
Attributes:
- rel - Specifies the relationship between the current document and the linked resource.
- href - The URL of the external file (CSS, favicon, etc.).
- type - Defines the MIME type (optional, e.g., text/css).
- media - Specifies the media type for which the linked document is optimized (e.g., screen, print).
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>Link Tag Example</title>
<link rel="stylesheet" href="[Link]
</head>
<body>
<h1>This heading is styled with an external CSS file.</h1>
</body>
</html>
Browser Support
Notes
- The <link> tag is self-closing and does not require an end tag.
- It must be placed inside the <head> section, before visible content.
- Commonly used for CSS, favicons, and preloading resources.
- Unlike the <style> tag, the <link> tag connects to an external file instead of embedding styles
directly in HTML.
- You can include multiple <link> tags to load multiple resources.
Conclusion
The <link> tag is essential for separating content from design, allowing external files like CSS or icons to
be linked to your HTML document.
It helps maintain cleaner, modular, and reusable code - a best practice in modern web development.
The <meta> tag provides metadata about the HTML document. Metadata is information that does
not display directly on the page, but is used by browsers, search engines, and other services.
Common uses include specifying the character set, page description, keywords, author, and
viewport settings for responsive design.
Syntax
[Link]
<meta charset="UTF-8">
<meta name="description" content="This is an example of meta description">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>Meta Tag Example</title>
<meta charset="UTF-8">
<meta name="description" content="This page demonstrates the use of meta tags.">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<h1>Welcome to My Website</h1>
<p>This page uses meta tags to provide metadata for browsers and search engines.</p>
</body>
</html>
Browser Support
The <meta> tag does not produce visible content but provides important information for SEO, character
encoding, and responsive behavior.
Notes
- The <meta> tag is self-closing and does not require an end tag.
- Must be placed inside the <head> section.
- Helps browsers render content correctly and search engines index pages accurately.
- Common uses: character encoding (charset), page description (name="description"), and
viewport settings for responsive design.
Conclusion
The <meta> tag is a key component of HTML documents for defining metadata, character encoding, and
responsive design settings.
Although it is invisible on the page, it plays a crucial role in SEO, accessibility, and proper rendering of
the webpage.
The <style> tag is used to embed CSS styles directly into an HTML document.
It allows you to define the look and formatting of elements on the page without using an external
stylesheet.
The <style> tag must be placed inside the <head> section (though it can also appear in the <body>
in some cases, but that's not recommended).
Syntax
[Link]
<style>
selector {
property: value;
}
</style>
Attributes
Attribute Description
Specifies the media type (e.g., screen, print) the styles apply
media
to.
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>Style Tag Example</title>
<style>
h1 {
color: green;
text-align: center;
}
p {
font-size: 18px;
color: blue;
}
</style>
</head>
<body>
<h1>Welcome to My Webpage</h1>
<p>This paragraph is styled using the <style> tag.</p>
</body>
</html>
Browser Support
The <style> tag itself is invisible but styles the page elements, changing colors, fonts, alignment, and other
visual properties.
Notes
- The <style> tag is used for internal CSS; external stylesheets are linked using <link>.
- It should be placed inside the <head> for proper HTML structure.
- The scoped attribute is obsolete and no longer recommended.
- Using <style> helps quickly test styles without creating separate CSS files, but for larger projects,
external CSS is preferred for maintainability.
Conclusion
The <style> tag allows you to define CSS rules within your HTML document, directly affecting the
appearance of elements.
Although it does not produce visible content by itself, it is crucial for custom styling and page design.
The <script> tag is used to embed or reference JavaScript code in an HTML document.
It allows you to create interactive features, handle events, manipulate the DOM, and perform
dynamic operations on a webpage.
Syntax
[Link]
<script>
// JavaScript code here
</script>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>Script Tag Example</title>
<script>
function showMessage() {
alert("Hello! This is a message from JavaScript.");
}
</script>
</head>
<body>
<h1>Click the button to see the message</h1>
<button onclick="showMessage()">Click Me</button>
</body>
</html>
Browser Support
The <script> tag itself is invisible, but it can execute code that displays alerts, modifies content, or
responds to user actions.
Notes
- The <script> tag can contain inline JavaScript or reference an external file.
- async and defer help improve page load performance.
- Scripts can be placed in <head> or at the end of <body> for faster rendering.
- Always ensure scripts are properly secured to prevent XSS vulnerabilities.
Conclusion
The <script> tag is essential for adding dynamic behavior and interactivity to HTML pages.
Although it does not produce visual content directly, it powers most modern web functionality, making it a
core element in web development.
HTML provides six levels of headings, <h1> through <h6>, to define content hierarchy and
structure.
Syntax
[Link]
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
Attributes
Attribute Description
Example
[Link]
Browser Support
Headings are visible and structured from largest (<h1>) to smallest (<h6>), helping organize content on the
page.
Notes
- Headings are block-level elements by default.
- Always use headings in order (<h1> -> <h2> -> <h3>) for proper semantic structure.
- Headings improve SEO and accessibility.
- Styles can be modified with CSS, but the semantic meaning remains.
Conclusion
HTML headings <h1> to <h6> define content hierarchy and page structure.
Using them correctly ensures better readability, SEO optimization, and accessibility for all users.
Learn how the HTML <hgroup> tag groups a heading with a subheading, alternative title, or tagline.
The <hgroup> tag represents a heading and its related secondary content.
It groups one <h1> to <h6> element with one or more elements containing a subheading,
alternative title, or tagline.
Syntax
[Link]
<hgroup>
<h1>Main heading</h1>
<p>Subheading or tagline</p>
</hgroup>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hgroup Tag Example</title>
<style>
hgroup {
border-left: 4px solid #29AB87;
padding-left: 16px;
}
hgroup h1 {
margin-bottom: 4px;
}
hgroup p {
margin-top: 0;
color: #555;
font-size: 1.1rem;
}
</style>
</head>
<body>
<hgroup>
<h1>Learn Modern HTML</h1>
<p>A beginner-friendly guide to semantic webpages</p>
</hgroup>
Browser Support
Notes
- Use one <h1> to <h6> element inside an <hgroup>.
- Write secondary content such as a subheading, alternative title, or tagline inside <p> elements.
- The heading element, not the <hgroup> itself, contributes to the document outline.
Conclusion
The <hgroup> tag provides a semantic way to keep a heading together with its supporting title
content.
Use it when a heading needs a subheading, alternative title, or tagline represented by one or more
paragraphs.
HTML Tag
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
Browser Support
Paragraphs are block-level elements that display text with spacing above and below. Multiple paragraphs are
automatically separated for readability.
Notes
- The <p> tag is a block-level element, so it starts on a new line and extends the full width of its
container.
- Avoid placing block-level elements like <div> or <h1> inside <p> tags.
- Use CSS to style paragraphs (color, font, spacing, alignment).
- Multiple <p> tags create distinct blocks of text on the page.
Conclusion
The <p> tag is the standard way to display paragraphs in HTML.
It provides readable and well-structured text content, which is essential for both users and search engines.
HTML
Tag
The
tag inserts a line break in text, moving content to a new line.
It is an empty (self-closing) tag and is useful for breaking lines without starting a new paragraph.
Syntax
[Link]
<br>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>BR Tag Example</title>
</head>
<body>
<h1>Line Break Example</h1>
<p>This is the first line.<br class="line-break-example">This is the second line after a break.
</p>
</body>
</html>
Browser Support
The <br> tag itself is invisible but forces the following content to start on a new line within the same
paragraph.
Notes
- <br> is self-closing; it does not require an end tag.
- It is commonly used inside <p> or other text containers to create line breaks.
- Overusing <br> instead of proper paragraphs (<p>) can lead to poor HTML structure.
- Can be styled with CSS if needed using class or id attributes.
Conclusion
The <br> tag provides a simple way to insert line breaks in text content without creating new paragraphs.
It is essential for formatting text within paragraphs or other inline content.
Learn how the HTML <wbr> tag suggests optional line-break positions inside long words, URLs,
and identifiers.
Syntax
[Link]
<p>HTML5<wbr>AND<wbr>CSS3</p>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WBR Tag Example</title>
<style>
.example {
width: 240px;
padding: 16px;
border: 2px solid #29AB87;
border-radius: 8px;
font-family: Arial, sans-serif;
line-height: 1.6;
}
</style>
</head>
<body>
<h1>Optional Word Breaks</h1>
<div class="example">
<p>
Visit
[Link]
to learn modern HTML.
</p>
<p>
ThisIsAReallyLong<wbr>ProductName<wbr>ThatCanWrapSafely
</p>
</div>
</body>
</html>
Browser Support
Notes
- The <wbr> element suggests a break opportunity; it does not force a new line.
- Unlike <br>, the browser uses the break only when wrapping is needed.
- Use it inside long URLs, identifiers, product names, or other text that has no natural spaces.
- The element does not add a hyphen when the line breaks. Use ­ when a conditional hyphen is
required.
- Do not place text inside <wbr>; it is an empty element.
- The <wbr> tag is a void element and must not have a closing tag.
- For broad wrapping rules across an entire element, CSS properties such as overflow-wrap or
word-break may be more appropriate.
Conclusion
The <wbr> tag provides a safe optional break point inside long, unbroken text.
Use it when the browser needs help wrapping a specific word or URL without forcing a line break every time.
The <hr> tag in HTML defines a thematic break between paragraph-level elements.
It is typically displayed as a horizontal line and is used to visually separate content or sections
within a page.
In HTML5, it represents a semantic break rather than just a visual divider.
Syntax
[Link]
<hr>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>HR Tag Example</title>
<style>
.styled-hr {
border: 0;
height: 4px;
background: linear-gradient(to right, #29AB87, #2ecc71);
border-radius: 2px;
}
</style>
</head>
<body>
<h1>Horizontal Rule Example</h1>
<p>This is the first section of text.</p>
Browser Support
The <hr> tag is rendered as a horizontal line that separates sections of content.
Its appearance can be customized using CSS for color, thickness, and style.
Notes
- The <hr> tag is self-closing; it does not require an end tag.
- It can be styled with CSS to match your website's design (e.g., gradient lines, dashed styles).
- In HTML5, <hr> indicates a semantic thematic break, not just a visual one.
- It helps improve content readability by visually dividing topics or sections.
Conclusion
The <hr> tag adds a horizontal divider to web pages to separate content sections visually and
semantically.
It's a simple yet effective way to improve structure and readability in web design.
The <pre> tag in HTML defines preformatted text - meaning the text inside it is displayed exactly as
written in the HTML file, including spaces, tabs, and line breaks.
It is often used to display code snippets, poems, or any text where spacing and alignment matter.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>PRE Tag Example</title>
<style>
.code-sample {
background-color: #f4f4f4;
border: 1px solid #ccc;
padding: 10px;
font-family: "Courier New", monospace;
color: #333;
border-radius: 6px;
}
</style>
</head>
<body>
<h1>Preformatted Text Example</h1>
<p>The <pre> tag preserves spacing and line breaks exactly as they appear in the source code.</
p>
<p>Notice how indentation and line breaks are preserved inside the <pre> tag.</p>
</body>
</html>
Browser Support
The <pre> tag displays text in a fixed-width font, maintaining spaces and line breaks exactly as written.
This makes it ideal for displaying source code or formatted text blocks.
Notes
- The <pre> tag maintains white spaces, line breaks, and indentation.
- Text inside <pre> is typically shown in a monospaced font (like Courier).
- You can combine <pre> with to represent formatted code blocks semantically.
- Avoid excessive use for regular text - it's meant for preformatted or technical content.
Conclusion
The <pre> tag is essential for displaying preformatted or code-style text where spacing and alignment
are crucial.
It ensures that text appears exactly as written in the HTML, making it perfect for code snippets, ASCII art, or
structured data displays.
HTML Tag
The tag in HTML is used to bolden text without adding extra importance or emphasis.
It visually highlights content by making it bold, often used for keywords, product names, or other text
that needs attention - but not strong semantic meaning.
For emphasizing text semantically, you should use the tag instead.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>B Tag Example</title>
<style>
.highlight {
color: #29AB87;
font-weight: bold;
background-color: #f0f0f0;
padding: 2px 4px;
border-radius: 4px;
}
</style>
</head>
<body>
<h1>HTML <b> Tag Example</h1>
<p>
The <b> tag makes text <b class="highlight" id="keyword" title="Bold Text">bold</b> without c
hanging its meaning.
</p>
<p>
Example: This is a <b>bold statement</b> in a paragraph.
</p>
</body>
</html>
Browser Support
The <b> tag displays text in bold weight to make it stand out visually, without adding semantic importance.
Notes
- The <b> tag is used purely for visual styling - it doesn't convey importance or emphasis.
- For important or emphasized text, prefer <strong> or <em>.
- The default browser style makes <b> text bold, but this can be customized with CSS.
- It is an inline element, meaning it doesn't start on a new line.
Conclusion
The <b> tag is useful for visually highlighting text without changing its meaning.
It's best for stylistic purposes like marking keywords or names, while <strong> should be used for
important or emphasized content.
HTML Tag
The tag is used to define important or emphasized text that carries strong semantic meaning.
Browsers typically render it in bold, but unlike the tag, it indicates that the enclosed text has greater
importance or urgency in the context.
It is useful for accessibility - screen readers will emphasize the text more strongly.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>Strong Tag Example</title>
<style>
.important {
color: #d32f2f;
font-weight: bold;
background-color: #fff0f0;
padding: 2px 6px;
border-radius: 4px;
}
</style>
</head>
<body>
<h1>HTML <strong> Tag Example</h1>
<p>
This tag is used to highlight text that has <strong class="important" id="warning" title="Imp
ortant Text">strong importance</strong> in meaning.
</p>
<p>
Example: Please <strong>save your work</strong> before exiting the program.
</p>
</body>
</html>
Browser Support
The <strong> tag displays text in bold, but more importantly, it conveys semantic emphasis that affects
accessibility and SEO.
Notes
- The <strong> tag is semantically meaningful, unlike <b>, which is purely visual.
- Screen readers emphasize <strong> text, improving accessibility.
- It is an inline element, meaning it does not start on a new line.
- You can style <strong> text with CSS to change its color, font weight, or background.
Conclusion
The <strong> tag is used for semantically important content that needs emphasis both visually and
contextually.
It enhances readability, accessibility, and SEO - making it more meaningful than the simple <b> tag.
HTML Tag
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>I Tag Example</title>
<style>
.italic-text {
color: #2c3e50;
font-style: italic;
background-color: #f0f8ff;
padding: 2px 4px;
border-radius: 4px;
}
</style>
</head>
<body>
<h1>HTML <i> Tag Example</h1>
<p>
This is an example of <i class="italic-text" id="foreign-word" title="Italicized Text">italic
text</i> in a paragraph.
</p>
<p>
Example: The Latin phrase <i>Carpe diem</i> means "Seize the day."
</p>
</body>
</html>
Browser Support
The <i> tag displays text in italic style for stylistic purposes without semantic emphasis.
Notes
- <i> is an inline element and does not start a new line.
- It is best used for technical terms, foreign words, or titles rather than emphasis.
- For semantic emphasis, use <em> instead of <i>.
- CSS can further style <i> text with color, background, or font size.
Conclusion
The <i> tag is a stylistic tag used to italicize text in HTML.
It provides visual distinction without implying importance, making it ideal for stylistic purposes like foreign
words or technical terms.
HTML Tag
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>EM Tag Example</title>
<style>
.emphasis {
color: #d35400;
font-style: italic;
background-color: #fff8e1;
padding: 2px 4px;
border-radius: 4px;
}
</style>
</head>
<body>
<h1>HTML <em> Tag Example</h1>
<p>
This sentence contains <em class="emphasis" id="important-text" title="Emphasized Text">empha
sized text</em> that conveys importance.
</p>
<p>
Example: You should <em>read the instructions carefully</em> before starting the task.
</p>
</body>
</html>
Browser Support
The <em> tag visually italicizes text and semantically emphasizes it, providing meaning for accessibility and
screen readers.
Notes
- <em> is an inline element used for semantic emphasis.
- Screen readers pronounce emphasized text with more stress, improving accessibility.
- CSS can further style <em> text with color, font size, or background.
- For purely stylistic italics without semantic meaning, use <i>.
Conclusion
The <em> tag is essential for emphasizing text semantically in HTML.
It conveys importance for both human readers and assistive technologies while also rendering in italic style.
HTML Tag
The tag in HTML is used to highlight text, typically to indicate relevance or search results.
Browsers usually render it with a yellow background by default.
It is an inline element and does not change the text's semantic importance beyond visual
highlighting.
Syntax
[Link]
Attribute
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>MARK Tag Example</title>
<style>
.highlighted {
background-color: #ffeb3b;
color: #000;
padding: 2px 4px;
border-radius: 2px;
}
</style>
</head>
<body>
<h1>HTML <mark> Tag Example</h1>
<p>
This is an example of <mark class="highlighted" id="search-term" title="Highlighted Text">hig
hlighted text</mark> in a paragraph.
</p>
<p>
Example: The keyword <mark>HTML tutorial</mark> was found in the search results.
</p>
</body>
</html>
Browser Support
The <mark> tag visually highlights text, making it stand out, typically with a yellow background.
It is commonly used to indicate search keywords or important passages.
Notes
- <mark> is an inline element and preserves surrounding text flow.
- The default highlight color can be changed using CSS for background and text color.
- It is semantic for highlighted content, useful for marking relevant information or search results.
- Avoid overusing <mark> to prevent visual clutter.
Conclusion
The <mark> tag is a visual highlighting element that draws attention to important text or search results.
It improves readability and focus without changing the semantic importance of the surrounding content.
HTML Tag
The tag in HTML is used to reduce the font size of text, usually for fine print, disclaimers, legal
notes, or side comments.
It is an inline element and typically does not change the semantic meaning of the text.
Syntax
[Link]
Attribute
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>SMALL Tag Example</title>
<style>
.fine-print {
font-size: 0.8em;
color: #555;
}
</style>
</head>
<body>
<h1>HTML <small> Tag Example</h1>
<p>
This is normal text, and here is <small class="fine-print" id="disclaimer" title="Small Text
Example">some smaller fine-print text</small> within the paragraph.
</p>
<p>
Example: <small>(c) 2025 Company Name. All rights reserved.</small>
</p>
</body>
</html>
Browser Support
The <small> tag reduces the font size of its content, making it suitable for disclaimers, copyright notes, or
secondary information.
Notes
- <small> is an inline element and does not create a new line.
- The font size can be further adjusted using CSS (font-size property).
- It is ideal for non-critical information that should be visible but not dominant.
- Avoid using <small> for main content, as it reduces readability.
Conclusion
The <small> tag is useful for displaying fine print or secondary text in a smaller font size.
It ensures that additional or less important information is presented clearly without dominating the main
content.
HTML Tag
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>DEL Tag Example</title>
<style>
.removed {
color: #d32f2f;
text-decoration: line-through;
}
</style>
</head>
<body>
<h1>HTML <del> Tag Example</h1>
<p>
Original price: <del class="removed" id="old-price" datetime="2025-10-29" cite="[Link]
[Link]" title="Old Price">500</del>
</p>
<p>
Updated price: 350
</p>
</body>
</html>
Browser Support
Notes
- <del> is an inline element and does not break the flow of surrounding text.
- Combine with <ins> to indicate inserted content alongside deletions.
- The datetime and cite attributes add semantic metadata about the deletion. They are not visually
rendered but can be read and interpreted by search engines, screen readers, and other tools.
- CSS can further style <del> to modify color, thickness, or strikethrough style.
Conclusion
The <del> tag highlights deleted or obsolete content in HTML.
It is ideal for revision tracking, pricing updates, or marking removed information on a webpage.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>INS Tag Example</title>
<style>
.new-price {
color: #2e7d32;
text-decoration: underline;
}
</style>
</head>
<body>
<h1>HTML <ins> Tag Example</h1>
<p>
Updated price: <ins class="new-price" id="new-price" datetime="2025-10-29" cite="[Link]
[Link]" title="New Price">350</ins>
</p>
</body>
</html>
- What is visible:
<ul class="wp-block-list">
<li>The content inside <ins> (350) is underlined.</li>
Browser Support
The <ins> tag displays text with an underline to indicate newly inserted content.
Attributes like datetime and cite are semantic and not directly visible.
Notes
- <ins> is an inline element and does not break the line.
- Commonly used for content updates or corrections alongside <del>.
- The datetime and cite attributes add semantic metadata about the insertion. They are not
visually rendered but can be read and interpreted by search engines, screen readers, and other tools
for SEO purpose.
- CSS can customize underline style, color, or font for inserted text.
Conclusion
The <ins> tag visually indicates newly inserted content with an underline, while also providing semantic
meaning via attributes like datetime and cite.
It is ideal for showing revisions, updates, or additions on a web page.
HTML Tag
The tag in HTML is used to display subscript text, which appears smaller and slightly below the
baseline of normal text.
It is commonly used in mathematical formulas, chemical formulas, and footnotes.
It is an inline element.
Syntax
[Link]
<sub>Subscript text</sub>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>SUB Tag Example</title>
<style>
.chemical {
color: #2c3e50;
font-size: 0.9em;
}
</style>
</head>
<body>
<h1>HTML <sub> Tag Example</h1>
<p>
Water chemical formula: H<sub class="chemical" id="water-sub" title="Subscript">2</sub>O
</p>
<p>
Example: CO<sub>2</sub> is carbon dioxide.
</p>
</body>
</html>
Browser Support
The <sub> tag displays text slightly below the baseline, often in smaller font size, making it ideal for
chemical formulas, footnotes, or mathematical notation.
Notes
- <sub> is an inline element and does not break the line.
- CSS can be used to further style subscript text (color, font-size).
- Often paired with <sup> for superscripts in formulas and citations.
- Avoid overusing for normal text; it is meant for specialized notation.
Conclusion
The <sub> tag is used for subscript text, commonly in chemical, mathematical, or scientific contexts.
It visually shifts the text below the baseline, ensuring proper formatting for technical content.
HTML Tag
The tag in HTML is used to display superscript text, which appears smaller and slightly above the
baseline of normal text.
It is commonly used in mathematical powers, chemical notation, footnotes, or references.
It is an inline element.
Syntax
[Link]
<sup>Superscript text</sup>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>SUP Tag Example</title>
<style>
.exponent {
color: #2c3e50;
font-size: 0.9em;
}
</style>
</head>
<body>
<h1>HTML <sup> Tag Example</h1>
<p>
Mathematical example: 5<sup class="exponent" id="power" title="Superscript">2</sup> = 25
</p>
<p>
Footnote example: The term "HTML"<sup>1</sup> stands for Hypertext Markup Language.
</p>
</body>
</html>
Browser Support
The <sup> tag displays text slightly above the baseline, making it suitable for exponents, footnotes, and
reference numbers.
Notes
- <sup> is an inline element and does not break the line.
- Often paired with <sub> for scientific or mathematical notation.
- CSS can adjust font size, color, or spacing for superscript text.
- Ideal for exponents, footnotes, or references rather than normal text.
Conclusion
The <sup> tag is used for superscript text, such as exponents, footnotes, or references.
It visually raises the text above the baseline, providing correct formatting for technical and academic content.
HTML Tag
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>U Tag Example</title>
<style>
.underline {
text-decoration: underline;
color: #1a237e;
}
</style>
</head>
<body>
<h1>HTML <u> Tag Example</h1>
<p>
This is an <u class="underline" id="important-word" title="Underlined Text">underlined word</
u> in a paragraph.
</p>
<p>
Example: Please read the <u>Terms and Conditions</u> carefully.
</p>
</body>
</html>
Browser Support
The <u> tag visually underlines the text to make it stand out, often used for stylistic emphasis without
implying semantic importance.
Notes
- <u> is an inline element and does not create a new line.
- Use CSS for additional styling (color, font weight, underline style).
- In HTML5, <u> is recommended for non-emphatic stylistic text, not for emphasis (use <em> or
<strong> for that).
- Avoid using <u> purely for emphasis, as it may be confused with hyperlinks.
Conclusion
The <u> tag is used to underline text, primarily for stylistic purposes.
It visually highlights content without changing semantic meaning, making it useful for names, special terms,
or visually distinct text.
The <blockquote> tag is used to define a long quotation from another source.
Browsers typically display it as a block element with indentation.
It is ideal for quoting multiple sentences or paragraphs.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>BLOCKQUOTE Tag Example</title>
<style>
blockquote {
border-left: 4px solid #2196f3;
padding-left: 10px;
margin: 10px 0;
font-style: italic;
color: #555;
}
</style>
</head>
<body>
<h1>HTML <blockquote> Tag Example</h1>
<blockquote cite="[Link] title="Source Example">
"The only limit to our realization of tomorrow is our doubts of today."
</blockquote>
</body>
</html>
Browser Support
The text appears indented with a left border and italicized style. The cite and title attributes are not
directly visible.
Notes
- <blockquote> is a block-level element.
- Use cite to provide semantic reference for the source.
- CSS can style the block (borders, padding, font style, background).
- Ideal for multi-line or paragraph quotations.
Conclusion
The <blockquote> tag is used for long quotations, visually distinguished by indentation and optionally
styled with CSS.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>Q Tag Example</title>
<style>
.inline-quote {
color: #2c3e50;
font-style: italic;
}
</style>
</head>
<body>
<h1>HTML <q> Tag Example</h1>
<p>
Albert Einstein once said: <q class="inline-quote" cite="[Link] title="Eins
tein Quote">Imagination is more important than knowledge.</q>
</p>
</body>
</html>
Browser Support
The text appears inline with quotation marks around it. The cite and title attributes are not directly
visible.
Notes
- <q> is an inline element and does not break the line.
- The cite attribute provides semantic reference for the source. It visually can't be seen.
- CSS can style the quotation (color, font-style, spacing).
- Ideal for short quotes inside a paragraph.
Conclusion
The <q> tag is used for short inline quotations.
It automatically adds quotation marks around the text and supports semantic source referencing.
HTML Tag
The tag is used to define the title of a creative work, such as a book, painting, movie, website, or
research paper.
Browsers usually display the text in italic by default.
It provides semantic meaning to the title of a referenced work.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>Cite Tag Example</title>
<style>
cite {
font-style: italic;
color: #2c3e50;
}
</style>
</head>
<body>
<h1>HTML <cite> Tag Example</h1>
<p>
The painting <cite title="Mona Lisa by Leonardo da Vinci">Mona Lisa</cite> is one of the most
famous artworks in the world.
</p>
<p>
The movie <cite class="film" id="inception" style="color:#e67e22;">Inception</cite> directed
by Christopher Nolan received critical acclaim.
</p>
</body>
</html>
Browser Support
The cited text appears in italic style by default. The title attribute is visible when hovering over the
element.
Notes
- The <cite> tag should be used only for titles of works, not for people's names.
- It is inline and does not introduce a line break.
- You can override the default italic style using CSS.
- Adds semantic meaning useful for accessibility and search engines.
Conclusion
The <cite> tag identifies the title of a creative or referenced work, displaying it in italic by default.
It helps convey meaning to both users and search engines by marking important referenced material.
HTML Tag
The tag in HTML defines an abbreviation or acronym, such as "HTML," "CSS," or "NASA."
When a user hovers over the abbreviation, the browser displays the full form (if provided using the
title attribute).
This helps improve accessibility, readability, and SEO by clarifying shortened terms.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>Abbr Tag Example</title>
<style>
abbr {
cursor: help;
}
</style>
</head>
<body>
<h1>HTML <abbr> Tag Example</h1>
<p>
The term <abbr title="HyperText Markup Language">HTML</abbr> is used to create the structure
of web pages.
</p>
<p>
<abbr title="Cascading Style Sheets" id="css" class="highlight" style="color: #2c3e50;">CSS</
abbr> controls the design and layout of web pages.
</p>
</body>
</html>
Browser Support
When you hover over the abbreviation, a tooltip displays the full form.
Notes
- The title attribute is essential for meaningful use of <abbr>.
- Screen readers announce the abbreviation's expansion, improving accessibility.
- The dotted underline can be customized or removed using CSS.
- The tag is inline and does not break text flow.
Conclusion
The <abbr> tag makes content more accessible and user-friendly by providing definitions for shortened
terms.
It enhances understanding, especially for technical and academic content, while improving SEO and
usability.
The <address> tag in HTML is used to define contact information for the author or owner of a
document or article.
It typically contains details such as name, email, physical address, phone number, or website URL.
Browsers usually render it in italic text and often add a line break before and after it.
Syntax
[Link]
<address>
Contact information goes here
</address>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>Address Tag Example</title>
<style>
address {
font-style: italic;
background-color: #f8f9fa;
border-left: 4px solid #29AB87;
padding: 10px 15px;
width: fit-content;
}
</style>
</head>
<body>
<h1>HTML <address> Tag Example</h1>
Browser Support
The contact information appears in italic style and may include links, line breaks, and structured details.
Notes
- The <address> element should represent contact information for its nearest <article> or
<body> ancestor.
- It should not be used for general physical addresses unrelated to document authorship.
- Text inside <address> is typically italicized, but this can be changed using CSS.
- Can include multiple child elements such as <a>, <br>, and <strong> for better structure.
Conclusion
The <address> tag provides a semantic and accessible way to display contact details of a webpage's
author or organization.
It helps users and search engines identify the owner or author's information clearly.
The <bdo> tag stands for Bi-Directional Override and is used to override the current text direction of
its content.
It's mainly helpful for displaying text in languages that are written from right to left (RTL), such as
Arabic or Hebrew, or for testing direction behavior.
You must use the dir attribute to specify the direction - either ltr (left-to-right) or rtl (right-to-left).
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>BDO Tag Example</title>
<style>
bdo {
background-color: #f0f0f0;
padding: 5px 8px;
border-radius: 5px;
font-weight: bold;
}
</style>
</head>
<body>
<h1>HTML <bdo> Tag Example</h1>
<p>
Another example with <code>dir="ltr"</code> (default left to right):
<bdo dir="ltr" title="Left to Right Direction">HTML5 & CSS3</bdo>
</p>
</body>
</html>
Browser Support
The <bdo dir="rtl"> element reverses the display direction of the text inside it.
"Hello World!" will appear from right to left instead of the default left-to-right.
Notes
- The dir attribute is mandatory for the <bdo> tag to function.
- Commonly used to override inherited text direction in multilingual websites.
- It can be styled with CSS for visual clarity or emphasis.
- Use <bdi> instead if you need the browser to automatically determine text direction.
Conclusion
The <bdo> tag is a powerful tool for controlling text direction manually, ensuring correct display of
multilingual content.
It's particularly useful in applications involving RTL languages or testing text rendering direction.
The <bdi> tag stands for Bi-Directional Isolation and is used to isolate a part of text that might have
a different direction from the surrounding text.
Unlike <bdo> (which forces a direction), <bdi> allows the browser to automatically determine the
correct direction based on the content.
It is particularly useful for user-generated content in multilingual or dynamic text environments.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>BDI Tag Example</title>
<style>
bdi {
background-color: #f0f0f0;
padding: 4px 6px;
border-radius: 4px;
color: #2c3e50;
}
table {
border-collapse: collapse;
margin-top: 10px;
}
td, th {
border: 1px solid #ccc;
padding: 8px 12px;
text-align: left;
}
</style>
</head>
<body>
<h1>HTML <bdi> Tag Example</h1>
<p>The <code><bdi></code> tag helps when you have mixed-direction text, such as English and Ara
bic usernames.</p>
<table>
<tr>
<th>Username</th>
<th>Score</th>
</tr>
<tr>
<td><bdi>John</bdi></td>
<td>95</td>
</tr>
<tr>
<td><bdi></bdi></td> <!-- Arabic name (right-to-left) -->
<td>89</td>
</tr>
<tr>
<td><bdi>Ali_</bdi></td> <!-- Mixed direction -->
<td>92</td>
</tr>
</table>
</body>
</html>
Browser Support
The Arabic or mixed-direction usernames will display properly aligned without breaking the layout - the
<bdi> tag isolates each name's direction automatically.
Notes
- The <bdi> element is useful for dynamic or user-generated content where text direction is
unknown.
- It ensures that the surrounding text layout remains consistent regardless of the inserted text's
language.
- You can use the optional dir attribute to force a direction if needed.
- Unlike <bdo>, <bdi> doesn't override the direction - it isolates it.
Conclusion
The <bdi> tag provides a smart and automatic solution for displaying multilingual text correctly.
It preserves layout and readability by isolating text direction without manual overrides - ideal for user names,
comments, and mixed-language content.
HTML Tag
The tag, also known as the anchor tag, is used to create hyperlinks in HTML.
It allows users to navigate between web pages, jump to specific sections, download files, or even
send emails using mailto: links.
It is one of the most important elements for web navigation and interconnectivity.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>Anchor Tag Example</title>
<style>
a {
color: #29AB87;
text-decoration: none;
font-weight: bold;
}
a:hover {
color: #1c7a63;
text-decoration: underline;
}
</style>
</head>
<body>
<h1>HTML <a> Tag Example</h1>
<p>
Visit our official website:
<a href="[Link] target="_blank" title="Visit HTML5 and CSS3 Official Site"
>
HTML5 and CSS3
</a>
</p>
<p>
Download a sample PDF file:
<a href="[Link] download="[Link]"
>Download PDF</a>
</p>
<p>
Send us an email:
<a href="[Link]
</p>
<p>
Jump to a section on this page:
<a href="#about">Go to About Section</a>
</p>
Browser Support
Notes
- Always use target="_blank" carefully - add rel="noopener noreferrer" for security.
- The <a> tag can link to internal elements using IDs (e.g., href="#section").
- You can turn any element (like <img> or <button>) into a link by wrapping it with <a>.
- Use the download attribute for files you want the user to save instead of opening.
- mailto will only work on the device which has default mail client has been configured.
Conclusion
The <a> tag enables hyperlinking and navigation, connecting web pages, files, and resources seamlessly.
It is the backbone of web navigation, making content interactive and interconnected.
The <nav> tag defines a section of a webpage that contains navigation links.
It helps users move around a website and assists search engines in understanding the site's
structure.
Commonly used for main menus, sidebars, and internal page navigation.
Syntax
[Link]
<nav>
<!-- Navigation links -->
</nav>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>Navigation Example</title>
</head>
<body>
<nav>
<a href="#home">Home</a>
<a href="#about">About</a>
<a href="#services">Services</a>
<a href="#contact">Contact</a>
</nav>
</body>
</html>
Browser Support
Notes
- The <nav> element should only include major navigation blocks.
- Don't wrap every set of links inside <nav>.
- Typically used in headers, sidebars, or footers for key navigation.
- Helps improve accessibility and SEO by indicating navigation landmarks.
Conclusion
The <nav> tag is essential for building structured and accessible websites.
It clearly defines navigational menus, improves SEO and usability, and enhances readability for both users
and assistive technologies.
Always use <nav> to wrap major navigation links, and style it consistently for a cohesive user experience.
The <ul> tag in HTML defines an unordered (bulleted) list, while the <li> tag defines individual list
items within that list.
Unordered lists are commonly used for displaying groups of items where the order doesn't matter,
such as menus, features, or simple lists.
Syntax
[Link]
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
Attributes
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Unordered List Example</title>
<style>
ul {
list-style-type: square;
padding: 10px;
width: 250px;
}
li {
margin: 5px 0;
color: #333;
font-size: 16px;
}
</style>
</head>
<body>
<h2>Favorite Fruits</h2>
<ul>
<li>Apple</li>
<li>Banana</li>
<li>Orange</li>
<li>Mango</li>
</ul>
</body>
</html>
Browser Support
The <ul> and <li> tags have full browser support across all modern browsers.
Use our Try It Editor to see how list markers appear differently based on CSS styling.
Notes
- The <ul> tag creates unordered (bulleted) lists, while <li> defines each list item.
- The bullet style can be changed using CSS: list-style-type.
- Lists can be nested by placing one <ul> inside another <li>.
- Avoid excessive nesting for readability and accessibility.
Conclusion
The <ul> and <li> tags are essential for structuring unordered lists.
They improve readability, accessibility, and the visual organization of grouped items.
For consistent styling, always control bullet appearance using CSS instead of deprecated HTML attributes.
Learn how the HTML <menu> tag represents a toolbar containing an unordered list of commands.
The <menu> tag represents a toolbar containing an unordered list of commands that a user can
perform or activate.
Its items are normally written as <li> elements containing controls such as buttons.
Syntax
[Link]
<menu>
<li><button type="button">Save</button></li>
<li><button type="button">Share</button></li>
</menu>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Menu Tag Example</title>
<style>
menu {
display: flex;
gap: 10px;
list-style: none;
padding: 0;
}
menu button {
border: 0;
border-radius: 6px;
background-color: #29AB87;
color: white;
padding: 10px 16px;
cursor: pointer;
}
menu button:hover {
background-color: #218c70;
}
</style>
</head>
<body>
<h1>Article Actions</h1>
<menu>
<li><button type="button">Save</button></li>
<li><button type="button">Share</button></li>
<li><button type="button">Print</button></li>
</menu>
</body>
</html>
Browser Support
Notes
- Use <menu> for a toolbar or an unordered list of commands that users can activate.
- Use <ul> for a general unordered list whose items are primarily displayed as content.
- Place each command in an <li>, usually with an interactive control such as a <button>.
- Browsers render <menu> similarly to <ul>; use CSS to create the toolbar layout.
- The old context-menu use of <menu> is obsolete and should not be used.
- The obsolete compact attribute should be replaced with CSS.
- Both the opening and closing tags are required.
Conclusion
The <menu> tag provides a semantic way to group commands into a toolbar.
Use it with list items and interactive controls when users need to perform a related set of actions.
The <ol> tag in HTML defines an ordered (numbered) list, and the <li> tag defines individual list
items within that list.
Ordered lists are used when the sequence of items is important, such as steps in a process,
rankings, or instructions.
Syntax
[Link]
<ol>
<li>Step 1</li>
<li>Step 2</li>
<li>Step 3</li>
</ol>
Attributes
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ordered List Example</title>
<style>
ol {
background-color: #f9f9f9;
padding: 15px;
border: 1px solid #ddd;
border-radius: 8px;
width: 250px;
}
li {
margin: 5px 0;
color: #333;
font-size: 16px;
}
</style>
</head>
<body>
<h2>Steps to Make Tea</h2>
<ol type="1" start="1" reversed>
<li>Boil water</li>
<li>Add tea leaves</li>
<li>Pour into cup</li>
<li>Add sugar and milk</li>
</ol>
</body>
</html>
Browser Support
The <ol> and <li> tags have full browser support across all modern browsers.
Use our Try It Editor to see how list numbering, types, and reversal behave in different browsers.
Notes
- The <ol> tag is used for ordered lists, and <li> defines the items within it.
- You can start numbering from any point using the start attribute.
[Link]
ol { list-style-type: upper-roman; }
Conclusion
The <ol> and <li> tags are perfect for creating structured, ordered lists where sequence matters.
They make step-by-step guides, rankings, and ordered data clear and easy to follow.
Use attributes like type, start, and reversed to fully control the numbering behavior.
The <dl> tag in HTML defines a description list (also known as a definition list).
Each description list contains one or more pairs of terms (<dt>) and definitions (<dd>).
It is commonly used to display glossaries, FAQs, or metadata in a structured way.
Syntax
[Link]
<dl>
<dt>Term 1</dt>
<dd>Description of Term 1</dd>
<dt>Term 2</dt>
<dd>Description of Term 2</dd>
</dl>
Attributes
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Description List Example</title>
<style>
dl {
padding: 15px;
width: 320px;
}
dt {
font-weight: bold;
color: #222;
margin-top: 10px;
}
dd {
margin-left: 20px;
color: #555;
margin-bottom: 5px;
}
</style>
</head>
<body>
<h2>HTML Terminology</h2>
<dl>
<dt>HTML</dt>
<dd>HyperText Markup Language - the standard language for creating web pages.</dd>
<dt>CSS</dt>
<dd>Cascading Style Sheets - used to style and layout web pages.</dd>
<dt>JavaScript</dt>
<dd>A scripting language used to create dynamic and interactive effects on web pages.</dd>
</dl>
</body>
</html>
Browser Support
The <dl>, <dt>, and <dd> tags have full browser support across all modern browsers.
Use our Try It Editor to see how terms and descriptions align differently based on your styling.
Notes
- <dl> wraps the entire list, <dt> defines the term, and <dd> defines the description.
- You can include multiple <dd> elements for one <dt> to provide more details.
- Description lists are ideal for FAQs, glossaries, or attribute-value data.
- Style them using CSS to create elegant layouts like two-column descriptions.
Conclusion
The <dl>, <dt>, and <dd> tags provide a semantic way to represent term-definition pairs.
They are perfect for glossaries, FAQs, and structured data lists.
With proper CSS styling, description lists can be made visually appealing and easy to read.
The <img> tag in HTML is used to embed images into a webpage. It is an empty tag (no closing
tag) and requires attributes like src (source URL of the image) and alt (alternative text for
accessibility and SEO).
Syntax
[Link]
Attributes
Example
[Link]
Browser Support
Notes
- The <img> tag does not have a closing tag.
- Always include the alt attribute - it improves accessibility and SEO.
- Use loading="lazy" for better performance (defers loading until the image is visible).
- Use responsive image techniques (srcset, sizes) for adaptive layouts.
Conclusion
The <img> tag is the backbone of visual content in web design. When used correctly with attributes like alt
, srcset, and loading, it makes websites both beautiful and efficient - ensuring faster loading, better
SEO, and accessibility compliance.
The <figure> tag in HTML is used to group self-contained media content like images, illustrations,
diagrams, code snippets, or videos - usually accompanied by a caption.
It helps semantically associate media with its description, making web content more meaningful and
accessible.
Syntax
[Link]
<figure>
<img src="[Link]" alt="A calm forest">
<figcaption>Morning view of a green forest</figcaption>
</figure>
Attributes
Example
[Link]
Browser Support
Notes
- The <figure> element is independent of the main content flow - it can be moved without affecting
meaning.
- Usually contains one visual element and one <figcaption>.
- Improves accessibility and SEO by providing descriptive context to media.
Conclusion
The <figure> tag brings semantic structure to visual content by grouping media with captions.
When used correctly, it enhances readability, accessibility, and the overall user experience on modern web
pages.
Syntax
[Link]
<figure>
<img src="[Link]" alt="Sunset over the ocean">
<figcaption>Sunset over the Arabian Sea</figcaption>
</figure>
Attributes
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Figcaption Example</title>
</head>
<body>
<h2>Example: Caption for an Image</h2>
<figure>
<img src="[Link] alt="Mountain Range" width="400">
<figcaption style="font-weight: bold;">A Random Image Mountain Range</figcaption>
</figure>
</body>
</html>
Browser Support
Notes
- You can place <figcaption> either before or after the main media inside <figure>.
- A <figure> should contain only one <figcaption> element.
- Helps screen readers and search engines understand the context of visual content.
Conclusion
The <figcaption> tag provides an accessible and semantic caption for media within a <figure>.
It improves user comprehension, visual structure, and SEO for content that includes images or illustrations.
The <audio> tag is used to embed sound content in an HTML document, such as music, podcasts,
or sound effects.
It supports multiple audio formats and provides playback controls like play, pause, and volume.
Syntax
[Link]
<audio controls>
<source src="audiofile.mp3" type="audio/mpeg">
<source src="[Link]" type="audio/ogg">
Your browser does not support the audio element.
</audio>
Attributes
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Audio Tag Example</title>
</head>
<body>
<h2>Example: Embedding an Audio File</h2>
<audio controls preload="metadata">
<source src="[Link] type="audio/mpeg"
>
<source src="[Link] type="audio/ogg">
Your browser does not support the audio element.
</audio>
</body>
</html>
Browser Support
Notes
- You can include multiple <source> elements to ensure cross-browser compatibility.
- If the browser doesn't support the <audio> tag, the fallback text inside will be displayed.
- Avoid using autoplay without user consent to prevent accessibility and UX issues.
Conclusion
The <audio> tag provides an easy and standardized way to integrate sound into web pages.
By combining multiple formats and attributes, you can create rich multimedia experiences with full browser
compatibility.
The <video> tag is used to embed video files directly into a webpage.
It supports multiple formats such as MP4, WebM, and Ogg, and provides built-in playback controls
for users to play, pause, or adjust volume.
Syntax
[Link]
<video controls>
<source src="video.mp4" type="video/mp4">
<source src="[Link]" type="video/webm">
Your browser does not support the video tag.
</video>
Attributes
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Video Tag Example</title>
</head>
<body>
<h2>Example: Embedding a Video</h2>
</body>
</html>
Output
Browser Output
Displays a built-in video player with play, pause, progress bar, and volume controls.
Use our Try It Editor to view and test video playback directly in your browser.
Browser Support
The <video> element is supported across all major browsers starting from Internet Explorer 9.
Older browsers (IE8 and below) do not support HTML5 video playback.
Notes
- You can include multiple <source> elements for different video formats to ensure compatibility.
- The poster attribute helps improve user experience by showing a thumbnail before playback starts.
- Avoid using autoplay without muted, as modern browsers block auto-playing videos with sound.
Conclusion
The <video> tag provides a native, flexible, and browser-friendly way to embed video content.
It replaces older plugins like Flash and supports modern formats and responsive attributes for seamless
integration across devices.
The <source> tag is used to define multiple media resources for the <audio> and <video>
elements.
It allows the browser to choose the best supported format automatically, ensuring better playback
compatibility across devices.
Syntax
[Link]
Attributes
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Source Tag Example</title>
</head>
<body>
<h2>Example: Using <source> inside <video></h2>
<audio controls>
<source src="[Link] type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</body>
</html>
Output
Browser Output
When used inside <audio> or <video>, the browser automatically picks the first supported file for
mat and plays it.
Use our Try It Editor to see how browsers select media formats dynamically.
Browser Support
The <source> tag is fully supported in all major browsers starting from Internet Explorer 9.
It ensures media elements remain functional even when certain formats aren't supported.
Notes
- Always include at least two <source> elements for best compatibility (e.g., MP4 + WebM for
videos).
- Browsers read <source> elements from top to bottom and stop when they find the first supported
format.
- The <source> tag does not display anything by itself - it must be nested inside <video>,
<audio>, or <picture>.
Conclusion
The <source> tag improves the flexibility and compatibility of media elements by letting developers provide
multiple file formats.
It ensures that users across all browsers and devices can play the same content smoothly without additional
plugins.
The <track> tag is used to add text tracks (like subtitles, captions, descriptions, or chapters) to
<video> and <audio> elements.
It improves accessibility by providing text alternatives for users who are deaf, hard of hearing, or
non-native speakers.
Syntax
[Link]
Attributes
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Track Tag Example</title>
</head>
<body>
<h2>Example: Adding Subtitles to a Video</h2>
</body>
</html>
Output
Browser Output
Displays a video with a subtitles or captions option that can be toggled using the video player's
menu.
Use our Try It Editor to see how subtitle files appear while the video plays.
Browser Support
The <track> element is supported in all modern browsers (from IE10+ for full functionality).
Older browsers may ignore subtitle tracks or not display them in the video controls.
To switch between the subtitles click on three vertical dots at bottom right of the video and then click on CC
(captions) and choose the desired subtitle.
Notes
- The text file used in src must be in WebVTT (.vtt) format.
- The kind attribute determines the purpose of the track (e.g., subtitles for translation, captions for
hearing-impaired users).
- You can include multiple <track> tags for different languages or purposes.
- The <track> element is empty, meaning it doesn't have a closing tag.
Conclusion
The <track> tag enhances accessibility and internationalization in multimedia content.
By including properly formatted caption or subtitle files, you make your videos more inclusive and
user-friendly for a global audience.
The <embed> tag in HTML is used to embed external content such as videos, audio, PDFs, or
interactive media (like SVGs or Flash) directly into a webpage.
It is a self-closing tag and doesn't require a closing tag. It serves as a generic container for external
resources when specific tags (like <video> or <audio>) are not suitable.
Syntax
[Link]
Attributes
Attribute Description
Example
Browser Support
The PDF file appears inline with scroll and zoom options inside the page.
The video plays directly inside the defined area if supported by the browser.
Notes
- <embed> is a generic container for external content; use it when a specialized element (like
<audio>, <video>, or <object>) isn't suitable.
- Many use-cases (video/audio) are better handled by <video> / <audio> because those provide
built-in controls and better accessibility.
- For documents (PDF) consider <iframe> or <object> as alternatives - browser UI and print/zoom
support may differ.
- Some embedded content types may require browser plugins or specific MIME handlers; these
cases can produce inconsistent behavior across browsers.
- Security: avoid embedding untrusted content. Use correct type and host files over HTTPS to
prevent mixed-content issues.
- Accessibility: provide fallback content and ensure embedded content is reachable via
keyboard/screen readers when applicable.
- Sizing & responsiveness: use CSS (or wrapper elements) to make embedded content responsive;
fixed width/height can break layouts on small screens.
Conclusion
The <embed> tag is a versatile tool for embedding various types of media into a webpage.
While it provides a simple way to display external content like PDFs or videos, it lacks advanced playback
controls - so for audio or video content, dedicated tags like <video> and <audio> are generally preferred.
The <object> element embeds an external resource such as a PDF or image and can provide
accessible fallback HTML when the resource cannot be displayed.
For audio, video, or another webpage, prefer the dedicated <audio>, <video>, or <iframe> element.
Syntax
[Link]
Attributes
Attribute Description
Example
Browser Support
The <object> tag is supported by all modern browsers, including Internet Explorer 9 and above.
However, the actual rendering depends on the content type and whether the browser supports that MIME
type (e.g., PDF or image).
Notes
- The <object> tag can embed images, PDFs, multimedia, and even web pages.
- If the browser doesn't support the specified media type, the fallback content between <object> and
</object> will be shown.
- Use the type attribute to specify the correct MIME type - this helps browsers determine how to
handle the content.
- For embedding multimedia like audio and video, prefer <audio> and <video> tags for better
compatibility and control.
- <object> can be nested to provide multiple fallback sources.
- Security note: avoid embedding untrusted external content directly to prevent potential script
injection.
Conclusion
Use <object> when you need to embed a supported external resource and provide fallback HTML.
Use dedicated elements for audio, video, and webpages, and do not use obsolete <param> children.
The <param> element is obsolete and must not be used in new HTML documents.
The <param> element is obsolete and non-conforming. It was historically used to pass parameters
to plugin-based content inside an <object> element, but it must not be used in new HTML
documents.
Standards Status
Item Status
Historical Syntax
The following syntax may appear in old websites or archived documentation. It is shown only so you can
recognize and replace it.
<object data="legacy-resource">
<param name="autoplay" value="true">
</object>
Modern Replacement
Choose the element designed for the resource. Use <audio> or <video> for media, <iframe> for another
HTML page, and the data and type attributes directly on <object> for an external resource.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Modern Object Example</title>
</head>
<body>
<object data="[Link] type="application/
pdf" width="600" height="400">
<p>Your browser cannot display the PDF. <a href="[Link]
amples/[Link]">Download it</a>.</p>
</object>
</body>
</html>
Conclusion
The <param> element belongs only in legacy-code discussions. Do not use it in new projects; select the
appropriate modern HTML element or API instead.
The <picture> tag in HTML is used to provide multiple image sources for responsive designs.
It allows the browser to choose the most suitable image based on screen size, resolution, or format
support.
It's commonly used with <source> and <img> tags inside it.
Syntax
[Link]
<picture>
<source srcset="[Link]" media="(max-width: 600px)">
<source srcset="[Link]" media="(min-width: 601px)">
<img src="[Link]" alt="Description">
</picture>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Picture Tag Example</title>
</head>
<body>
</body>
</html>
Browser Support
Notes
- The <picture> element itself does not display anything - the <img> inside it is what's visible.
- You can include multiple <source> tags with different media queries or file formats.
- Use <picture> for art direction (different images for different devices) rather than simple scaling.
- Always include alt text in <img> for accessibility.
Conclusion
The <picture> tag provides a powerful method for delivering responsive and adaptive images.
It improves performance and user experience by letting browsers choose the most appropriate image based
The <canvas> tag in HTML is used to draw graphics dynamically via JavaScript, including shapes,
charts, animations, and games.
It is a container for graphics but does not have any visible output by itself until you draw on it using
JavaScript.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Canvas Tag Example</title>
<style>
canvas { border: 2px solid #29AB87; }
</style>
</head>
<body>
<h2>Drawing on Canvas</h2>
<canvas id="myCanvas" width="400" height="200">
Your browser does not support the HTML canvas tag.
</canvas>
<script>
const canvas = [Link]('myCanvas');
const ctx = [Link]('2d');
// Draw a rectangle
[Link] = "#FF0000";
[Link](50, 50, 150, 100);
// Draw a circle
[Link]();
[Link](300, 100, 50, 0, 2 * [Link]);
[Link] = "#0000FF";
[Link]();
</script>
</body>
</html>
Browser Support
Notes
- The <canvas> tag cannot display content on its own - all graphics must be drawn with
JavaScript.
- Supports drawing 2D graphics via getContext('2d') and 3D graphics via WebGL (
getContext('webgl')).
- Useful for games, charts, visualizations, and dynamic graphics.
- Always include fallback content for accessibility and unsupported browsers.
- CSS can style the canvas border, background, or size but not its internal content - that must be
drawn via JS.
Conclusion
The <canvas> tag is a versatile element for dynamic and interactive graphics in web pages.
It is fully supported across modern browsers, but requires JavaScript to render any visible content.
The <map> tag in HTML is used to define an image map, which is a clickable region on an image
that links to different destinations.
Each clickable area within the map is defined using the <area> tag.
Syntax
[Link]
<map name="mapName">
<area shape="shapeType" coords="x1,y1,x2,y2" href="URL" alt="description">
</map>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Map Tag Example</title>
</head>
<body>
<map name="worldmap">
<area shape="rect" coords="46,13,170,230" href="[Link] alt=
"Rectangle">
<area shape="rect" coords="215,38,370,200" href="[Link] alt="S
quare">
<area shape="circle" coords="107,345,76" href="[Link] alt="Cir
cle">
<area shape="poly" coords="295,250,372,295,372,383,295,432,218,385,215,295" href="[Link]
[Link]/wiki/Hexagon" alt="Poly">
</map>
</body>
</html>
Browser Support
All major browsers, including Internet Explorer 9+, support <map> and <area> tags.
Notes
- The <map> tag itself does not display anything; it must be linked to an <img> using the usemap
attribute.
- The <area> tags define the clickable shapes: rect, circle, or poly.
- Always include alt text for accessibility.
- Coordinates are pixel-based relative to the image's size; for responsive images, JavaScript may be
needed to adjust coordinates dynamically.
Conclusion
The <map> tag allows you to create interactive images with multiple clickable areas.
It works across all modern browsers and IE9+, but proper coordinates and alt text are important for usability
and accessibility.
The <area> tag defines clickable areas within an image map created by the <map> element.
Each <area> represents a region of the image that acts as a hyperlink to another page, section, or
resource.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Map Tag Example</title>
</head>
<body>
<map name="worldmap">
<area shape="rect" coords="46,13,170,230" href="[Link] alt=
"Rectangle">
<area shape="rect" coords="215,38,370,200" href="[Link] alt="S
quare">
<area shape="circle" coords="107,345,76" href="[Link] alt="Cir
cle">
<area shape="poly" coords="295,250,372,295,372,383,295,432,218,385,215,295" href="[Link]
[Link]/wiki/Hexagon" alt="Poly">
</map>
</body>
</html>
Browser Support
The <area> element is fully supported by all modern browsers including Internet Explorer 9+.
Notes
- The <area> tag must be nested inside a <map> element.
- The coords values depend on the defined shape:
- rect: x1, y1, x2, y2
- circle: x, y, radius
Conclusion
The <area> tag makes sections of an image clickable, creating interactive and engaging content.
It's an essential companion to <map> and is supported across all major browsers, making it reliable for web
navigation and visual interfaces.
The <table> tag in HTML defines a table - a structured arrangement of data in rows and columns.
It serves as the container for all related elements like <tr>, <th>, <td>, <thead>, <tbody>, and
<tfoot>
Syntax
[Link]
<table>
<tr>
<th>Heading 1</th>
<th>Heading 2</th>
</tr>
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
</table>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Table Tag Example</title>
<style>
table {
width: 60%;
border-collapse: collapse;
margin: 20px auto;
}
th, td {
border: 1px solid #555;
padding: 10px;
text-align: center;
}
th {
background-color: #29AB87;
color: white;
}
</style>
</head>
<body>
<table>
<tr>
<th>Language</th>
<th>Type</th>
<th>Year Introduced</th>
</tr>
<tr>
<td>HTML</td>
<td>Markup</td>
<td>1993</td>
</tr>
<tr>
<td>CSS</td>
<td>Style Sheet</td>
<td>1996</td>
</tr>
<tr>
<td>JavaScript</td>
<td>Programming</td>
<td>1995</td>
</tr>
</table>
</body>
</html>
Browser Support
Notes
- The <table> element is the parent container for all table-related elements.
- Use <thead>, <tbody>, and <tfoot> for semantic grouping.
- CSS should be preferred for styling (borders, spacing, alignment).
- For accessibility, include a <caption> or use scope attributes in header cells.
Conclusion
The <table> tag is the backbone of tabular data in HTML.
When combined with semantic child elements and proper CSS, it allows for both well-structured and
visually appealing data presentation.
Syntax
[Link]
<table>
<caption>Table Title</caption>
<tr>
<th>Heading 1</th>
<th>Heading 2</th>
</tr>
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
</table>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Caption Tag Example</title>
<style>
table {
border-collapse: collapse;
width: 60%;
margin: 20px auto;
}
th, td {
border: 1px solid #444;
padding: 10px;
text-align: center;
}
caption {
caption-side: top;
font-weight: bold;
font-size: 1.2em;
color: #29AB87;
margin-bottom: 8px;
}
</style>
</head>
<body>
<table>
<caption>World Programming Languages Overview</caption>
<tr>
<th>Language</th>
<th>Creator</th>
<th>Release Year</th>
</tr>
<tr>
<td>Python</td>
<td>Guido van Rossum</td>
<td>1991</td>
</tr>
<tr>
<td>Java</td>
<td>James Gosling</td>
<td>1995</td>
</tr>
<tr>
<td>HTML</td>
<td>Tim Berners-Lee</td>
<td>1993</td>
</tr>
</table>
</body>
</html>
Browser Support
Notes
- Only one <caption> is allowed per table.
- The default position is above the table, but you can reposition it using CSS:
[Link]
Helps with accessibility, providing screen readers with context about the table's data.
Conclusion
The <caption> tag is a simple yet powerful way to make your tables more understandable and
accessible.
It enhances both usability and semantic meaning, especially when working with data-heavy layouts.
Syntax
[Link]
<table>
<thead>
<tr>
<th>Heading 1</th>
<th>Heading 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
</tbody>
</table>
Attributes
Attribute Description
The <thead> tag does not have any specific attributes. You
(None)
can use global attributes like class, id, or style.
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<table>
<thead>
<tr>
<th>Planet</th>
<th>Distance from Sun</th>
<th>Moons</th>
</tr>
</thead>
<tbody>
<tr>
<td>Mercury</td>
<td>57.9 million km</td>
<td>0</td>
</tr>
<tr>
<td>Earth</td>
<td>149.6 million km</td>
<td>1</td>
</tr>
<tr>
<td>Jupiter</td>
<td>778.5 million km</td>
<td>79</td>
</tr>
</tbody>
</table>
</body>
</html>
Browser Support
Notes
- The <thead> element should appear before <tbody> and <tfoot> within a table.
- It improves data organization and helps browsers render large tables efficiently.
- Useful for styling headers and keeping them fixed while scrolling with CSS or JavaScript.
- Tables without <thead> are still valid but less structured.
Conclusion
The <thead> tag defines a clear and accessible table header section, separating structure from content.
It's especially helpful for data tables, reports, and dashboards where clarity and readability are essential.
The <tbody> tag in HTML is used to group the main content rows (body) of a table.
It separates the table's data section from the header (<thead>) and footer (<tfoot>), helping improve
structure, readability, and performance for large datasets.
Syntax
[Link]
<table>
<thead>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
</tbody>
</table>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tbody Tag Example</title>
<style>
table {
border-collapse: collapse;
width: 70%;
margin: 20px auto;
text-align: center;
}
thead {
background-color: #29AB87;
color: white;
}
tbody tr:nth-child(even) {
background-color: #f9f9f9;
}
th, td {
border: 1px solid #555;
padding: 10px;
}
</style>
</head>
<body>
<table>
<thead>
<tr>
<th>Country</th>
<th>Capital</th>
<th>Population (Millions)</th>
</tr>
</thead>
<tbody>
<tr>
<td>India</td>
<td>New Delhi</td>
<td>1428</td>
</tr>
<tr>
<td>USA</td>
<td>Washington, D.C.</td>
<td>332</td>
</tr>
<tr>
<td>Japan</td>
<td>Tokyo</td>
<td>125</td>
</tr>
</tbody>
</table>
</body>
</html>
Browser Support
Notes
- The <tbody> tag is optional if the table only contains one set of rows, but browsers insert it
automatically in the DOM.
- It allows styling the main data section separately from the header and footer.
- Helps with table accessibility, scrolling, and printing optimization.
- Best practice: always include <thead>, <tbody>, and <tfoot> for semantic structure.
Conclusion
The <tbody> tag defines the core content section of a table, enhancing clarity and control over how data
rows are displayed and styled.
It's an essential element for managing and presenting tabular information efficiently.
Syntax
[Link]
<table>
<thead>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2">Footer Content</td>
</tr>
</tfoot>
</table>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tfoot Tag Example</title>
<style>
table {
border-collapse: collapse;
width: 70%;
margin: 20px auto;
text-align: center;
}
thead {
background-color: #29AB87;
color: white;
}
tfoot {
background-color: #e0f3ec;
font-weight: bold;
color: #333;
}
th, td {
border: 1px solid #555;
padding: 10px;
}
tbody tr:nth-child(even) {
background-color: #f9f9f9;
}
</style>
</head>
<body>
<table>
<thead>
<tr>
<th>Item</th>
<th>Price ()</th>
</tr>
</thead>
<tbody>
<tr>
<td>Notebook</td>
<td>50</td>
</tr>
<tr>
<td>Pencil</td>
<td>10</td>
</tr>
<tr>
<td>Eraser</td>
<td>5</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>Total</td>
<td>65</td>
</tr>
</tfoot>
</table>
</body>
</html>
Browser Support
All major browsers, including IE9+, support the <tfoot> tag completely.
Notes
- The <tfoot> section is optional but recommended for large tables with totals or summary data.
- In HTML source order, <tfoot> is placed before <tbody> for faster page rendering when tables
are loaded.
- Use CSS to style the footer differently from other table sections.
- <tfoot> improves data comprehension and accessibility, especially in screen readers.
Conclusion
The <tfoot> tag defines the footer of a table, providing space for totals, summaries, or concluding
remarks.
It helps organize table data more clearly while maintaining semantic meaning and consistent presentation.
Syntax
[Link]
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
</tr>
Attributes
Attribute Description
These attributes are deprecated. Use CSS instead for layout and styling.
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML tr Tag Example</title>
</head>
<body>
<h2>Example of the <tr> Tag</h2>
<table border="1">
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$150</td>
</tr>
</table>
</body>
</html>
Browser Support
Notes
- A <tr> must be placed inside a <table>, <thead>, <tbody>, or <tfoot> element.
- Each <tr> represents one row of table cells.
- It can contain both <th> (header cells) and <td> (data cells).
Conclusion
- The <tr> tag represents a single row in a table.
- It is used within <table>, <thead>, <tbody>, or <tfoot> elements.
- Each row contains one or more <th> or <td> cells.
In simple terms, the <tr> tag helps organize your table data horizontally - each <tr> creates one complete
row of information, making your table more structured and readable.
Syntax
Attributes
Attribute Description
Associates the header cell with one or more data cells (id
headers
values of <td> elements).
Tip: Use the scope attribute to improve accessibility, especially for assistive technologies.
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML th Tag Example</title>
</head>
<body>
<h2>Example of the <th> Tag</h2>
<table border="1">
<tr>
<th scope="col">Month</th>
<th scope="col">Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$150</td>
</tr>
</table>
</body>
</html>
Browser Support
Notes
- <th> is always contained inside <tr>.
- Can be used with <thead>, <tbody>, or <tfoot> to structure table headers.
- scope, colspan, and rowspan attributes improve accessibility and semantic clarity.
- Browser styling: Bold and center-aligned by default, but fully customizable via CSS.
Conclusion
- The <th> tag defines header cells in a table, giving structure to columns or rows.
- It enhances readability and accessibility, especially for screen readers.
- Using <th> properly ensures your tables are semantic, clear, and easy to interpret.
The <td> tag in HTML defines a standard data cell within a table.
Each <td> element represents a single piece of data in a table row (<tr>). It is one of the most
commonly used tags for displaying tabular data such as numbers, text, or links.
Syntax
[Link]
<td attribute="value">Content</td>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML td Tag Example</title>
<style>
table {
border-collapse: collapse;
width: 50%;
}
td, th {
border: 1px solid #333;
padding: 8px;
text-align: center;
}
</style>
</head>
<body>
<h2>Example of the <td> Tag</h2>
<table>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$150</td>
</tr>
<tr>
<td colspan="2">Total Savings: $250</td>
</tr>
</table>
</body>
</html>
Browser Support
Tip: Modern HTML prefers using CSS for alignment and presentation instead of deprecated attributes like
align or valign.
Notes
- <td> elements are always nested inside a <tr> (table row).
- Can be used with colspan or rowspan to merge cells horizontally or vertically.
- Default cell alignment: left-aligned and middle vertically aligned.
- To improve readability and accessibility, combine with<th> headers for data labeling.
Conclusion
- The <td> tag is used to display table data within rows.
- It represents the main data content of any table structure.
- Use CSS for better styling and layout instead of deprecated alignment attributes.
- Proper use of <td> ensures your data tables are clear, consistent, and responsive.
The <col> tag in HTML defines column properties for each column within a <colgroup> element.
It allows you to apply styling, width, or alignment to one or more columns of a table - without
repeating the same style on each <td> or <th> individually.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML col Tag Example</title>
<style>
table {
border-collapse: collapse;
width: 60%;
}
th, td {
border: 1px solid #333;
padding: 8px;
text-align: center;
}
</style>
</head>
<body>
<h2>Example of the <col> Tag</h2>
<table>
<colgroup>
<col span="1" style="background-color: #f2f2f2;">
<col span="1" style="background-color: #d9f7be;">
<col span="1" style="background-color: #ffd6e7;">
</colgroup>
<tr>
<th>Product</th>
<th>Price</th>
<th>Stock</th>
</tr>
<tr>
<td>Notebook</td>
<td>$5</td>
<td>120</td>
</tr>
<tr>
<td>Pencil</td>
<td>$1</td>
<td>500</td>
</tr>
</table>
</body>
</html>
Browser Support
The <col> tag itself does not produce visible content; it affects how columns are displayed.
Notes
- The <col> tag is always nested inside <colgroup>.
- It is primarily used to style multiple columns efficiently.
- The tag itself has no visible effect - only styling effects are reflected.
- You can apply a class or id to customize multiple columns through external CSS.
Conclusion
The <col> tag defines styling or structural properties for table columns. It enhances maintainability by
applying consistent styles across multiple cells. When used properly inside <colgroup>, it provides
cleaner and more semantic table layouts.
The <colgroup> tag in HTML is used to group one or more columns in a table for formatting
purposes.
It allows you to apply common styles or attributes to a group of columns, making it easier to
maintain a consistent design.
Syntax
[Link]
<table>
<colgroup>
<col span="number" style="property:value;">
</colgroup>
...
</table>
Attributes
Example
[Link]
<!DOCTYPE html>
<html>
<body>
<table border="1">
<colgroup>
<col span="1" style="background-color: #ffdddd;">
<col span="2" style="background-color: #ddffdd;">
</colgroup>
<tr>
<th>Item</th>
<th>Price</th>
<th>Availability</th>
</tr>
<tr>
<td>Laptop</td>
<td>$1200</td>
<td>In Stock</td>
</tr>
<tr>
<td>Tablet</td>
<td>$500</td>
<td>Out of Stock</td>
</tr>
</table>
</body>
</html>
Browser Support
The <colgroup> element is always placed inside the <table> element, but before <thead>, <tbody>,
and <tfoot> elements.
Notes
- The <colgroup> element must appear immediately after the <caption> element (if present)
and before <thead>, <tbody>, and <tfoot>.
- You can use multiple <col> elements inside <colgroup> to style specific columns.
- If you do not include <col> elements inside <colgroup>, you can still apply styles directly to
<colgroup>.
- The <colgroup> tag cannot contain any text content - only <col> tags.
Conclusion
The <colgroup> tag is a powerful and efficient way to apply collective styling or width control to
columns in a table.
It enhances readability and maintainability, especially for large tables with consistent column formatting.
The <form> tag is used to create an HTML form for collecting user input.
It acts as a container for various input elements like text fields, checkboxes, radio buttons, buttons,
and more.
Forms are essential for user interaction - for example, submitting login details or feedback.
Syntax
[Link]
Attributes
Attribute Description
method Defines how the form data is sent - either GET or POST.
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Form Example</title>
</head>
<body>
<h2>Registration Form</h2>
<form action="/samples/form_processor.php" method="post" enctype="multipart/form-data">
<label for="name">Full Name:</label><br>
<input type="text" id="name" name="fullname" placeholder="Enter your name" required><br><br>
<label for="email">Email:</label><br>
<input type="email" id="email" name="email" required><br><br>
Output
Browser Output
You'll see a registration form with input fields for name, email, and photo upload.
Once filled, clicking Register will open a new tab (because of target="_blank") showing the submi
ssion result.
Use our TryIt Editor to test this behavior interactively.
Browser Support
The <form> element itself doesn't produce any visible output until form controls are added inside it.
Notes
- The <form> tag itself does not produce visible output - the contained elements do.
- Always validate user input for security.
- Use HTTPS when submitting sensitive data.
Conclusion
The <form> tag is the foundation of web interactivity, allowing users to submit data efficiently and securely.
It's one of the most essential building blocks for any web application.
The <input> tag is used to create interactive form controls for user input.
It can represent a text field, checkbox, radio button, file selector, password box, email, number input,
and more.
The type of input is determined by the type attribute.
Syntax
[Link]
Attributes
Attribute Description
min, max Minimum and maximum values (for number, date, etc.).
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Input Tag Example</title>
</head>
<body>
<h2>Input Types Example</h2>
<form action="/samples/form_processor.php" method="post">
<label for="username">Username:</label><br>
<input type="text" id="username" name="username" placeholder="Enter your username" required><
br><br>
<label for="email">Email:</label><br>
<input type="email" id="email" name="email" placeholder="Enter your email"><br><br>
<label for="age">Age:</label><br>
<input type="number" id="age" name="age" min="1" max="100"><br><br>
<label for="gender">Gender:</label><br>
<input type="radio" id="male" name="gender" value="male">
<label for="male">Male</label>
<input type="radio" id="female" name="gender" value="female">
<label for="female">Female</label><br><br>
Output
Browser Output
You will see multiple input fields: text box, email, number, and radio buttons.
Filling the fields and clicking Submit sends the data to the URL specified in the action attribut
e.
Use our TryIt Editor to test how each input type behaves and validates data.
Browser Support
Notes
- <input> is a self-closing tag; it does not wrap content.
- The type attribute determines the control behavior and validation.
- Use required, min, max, pattern, and other attributes to enforce client-side validation.
- Combine with <label> for accessibility and better UX.
Conclusion
The <input> tag is the most versatile form element in HTML.
It allows developers to collect a wide range of user data efficiently and works in all modern browsers.
Proper use of attributes ensures valid, accessible, and interactive forms.
The <textarea> tag is used to create a multi-line text input field in a form.
Unlike the <input type="text"> field, which is single-line, <textarea> allows users to enter large
blocks of text, like comments, feedback, or messages.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Textarea Example</title>
</head>
<body>
<h2>Feedback Form</h2>
<form action="/samples/form_processor.php" method="post">
<label for="feedback">Your Feedback:</label><br>
<textarea id="feedback" name="feedback" rows="5" cols="50" placeholder="Enter your feedback h
ere" required></textarea><br><br>
Output
Browser Output
You will see a multi-line text box where users can type long messages or feedback.
The placeholder text guides the user, and the textarea enforces the number of visible rows and co
lumns.
Try it in our TryIt Editor to see how resizing and typing works.
Browser Support
Notes
- <textarea> allows for multi-line user input, unlike <input type="text">.
- Always use <label> for accessibility.
- Combine with maxlength or wrap to control input length and display.
- You can set default text by placing content between the opening and closing <textarea> tags.
Conclusion
The <textarea> tag is essential for collecting long-form user input on web pages.
It provides flexibility for messages, comments, and feedback forms, and works consistently across modern
browsers.
The <button> tag is used to create a clickable button in an HTML form or web page.
It can contain text, images, or HTML content, unlike <input type="submit"> which is limited to plain
text.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Button Example</title>
</head>
<body>
<h2>Button Examples</h2>
<form action="/samples/form_processor.php" method="post">
<button type="submit" name="submitBtn" value="Submit">Submit Form</button>
<button type="reset">Reset Form</button>
<button type="button" onclick="alert('Hello!')">Click Me</button>
</form>
</body>
</html>
Output
Browser Output
Use our TryIt Editor to see the different button types and their behavior.
Browser Support
Notes
- <button> is more flexible than <input type="button"> because it can contain HTML or
images.
- Always use type="submit" for form submission and type="button" for custom actions.
- Use disabled to prevent user clicks when necessary.
Conclusion
The <button> tag is a versatile and interactive element for forms and web interfaces.
It allows developers to create custom buttons with text, images, or icons, enhancing the user experience.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Select Example</title>
</head>
<body>
<h2>Select Your Favorite Fruit</h2>
<form action="/samples/form_processor.php" method="post">
<label for="fruits">Choose a fruit:</label><br>
<select name="fruits" id="fruits" required>
<option value="">--Select--</option>
<option value="apple">Apple</option>
<option value="banana">Banana</option>
<option value="orange">Orange</option>
<option value="mango">Mango</option>
</select><br><br>
Output
Browser Output
You will see a drop-down menu where users can select a single fruit.
Clicking the arrow shows all available options, and the selected option is sent when submitting t
he form.
Try it in our TryIt Editor to see how selection works.
Browser Support
Notes
- The <select> tag must contain <option> elements.
- Use multiple for multi-selection lists.
- Use <optgroup> to group related options for better UX.
- Always include a placeholder option (value="") for validation purposes.
Conclusion
The <select> tag provides an organized way for users to pick from a list of choices.
It is widely supported and essential for forms requiring selection input.
Learn how the experimental HTML <selectedcontent> tag displays the selected option inside a
customizable select button.
The <selectedcontent> tag displays a clone of the currently selected <option> inside the button of a
customizable <select>.
This is a newer, experimental element with limited and evolving browser support. Use it as
progressive enhancement and verify compatibility before relying on it in production.
Syntax
[Link]
<select>
<button>
<selectedcontent></selectedcontent>
</button>
<option value="html">HTML</option>
<option value="css">CSS</option>
</select>
Attributes
Attribute Description
Example
Compatibility notice: This example uses customizable-select features that may not work in every browser.
In unsupported browsers, keep the underlying <select> usable as a standard form control.
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Selectedcontent Tag Example</title>
<style>
select,
::picker(select) {
appearance: base-select;
}
select {
min-width: 260px;
border: 2px solid #29AB87;
border-radius: 8px;
padding: 8px;
font: inherit;
}
option {
padding: 10px;
}
option::checkmark {
display: none;
}
.badge {
display: inline-grid;
width: 32px;
height: 32px;
place-items: center;
border-radius: 6px;
background-color: #e7f8f3;
color: #007a96;
font-weight: bold;
}
selectedcontent .description {
display: none;
}
</style>
</head>
<body>
<h1>Choose a Tutorial</h1>
<label for="tutorial">Tutorial:</label>
<select id="tutorial" name="tutorial">
<button>
<selectedcontent></selectedcontent>
</button>
<option value="css">
<span class="badge">C</span>
<span>CSS</span>
<small class="description">Style webpages</small>
</option>
<option value="javascript">
<span class="badge">JS</span>
<span>JavaScript</span>
<small class="description">Add interactivity</small>
</option>
</select>
</body>
</html>
Browser Support
Browser support is still evolving. Current compatibility data reports support in Chrome 135 and later and
related Chromium-based browsers, but not in Firefox, Safari, or Internet Explorer. Check current
compatibility data before production use.
Notes
- Treat <selectedcontent> as progressive enhancement because it is experimental and not yet
available across all major browser engines.
- Place it inside a <button> that is the first child of the related <select>.
- The <selectedcontent> element should be the button's only child, followed by the select's
<option> elements.
- When the selection changes, the browser replaces its contents with a clone of the newly selected
option's DOM content.
- Content inside the select button is inert, so controls inside the cloned content cannot be focused or
activated.
- Changing the selected option's child content dynamically does not necessarily refresh the existing
clone until the selection changes; update carefully in JavaScript frameworks.
- Use appearance: base-select on the select and its ::picker(select) pseudo-element to
opt into customizable-select rendering.
- Keep a functional native <select> experience as the fallback for unsupported browsers.
- Both the opening and closing tags are required.
Conclusion
The <selectedcontent> tag enables rich, styleable selected-option content in customizable select
controls.
Because the element is new and support is still changing, use it with progressive enhancement, a usable
fallback, and up-to-date browser testing.
The <option> tag is used inside a <select> element to define a single option in a drop-down list.
Each <option> represents a selectable value that the user can choose.
Syntax
[Link]
Attributes
Attribute Description
value The value sent to the server when the option is selected.
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Option Tag Example</title>
</head>
<body>
<h2>Select Your Favorite Color</h2>
<form action="/samples/form_processor.php" method="post">
<label for="colors">Choose a color:</label><br>
<select name="colors" id="colors" required>
<option value="">--Select--</option>
<option value="red">Red</option>
<option value="green" selected>Green</option>
<option value="blue">Blue</option>
<option value="yellow" disabled>Yellow (Unavailable)</option>
</select><br><br>
Output
Browser Output
You will see a drop-down list where users can select a color.
The green option is preselected, and yellow is disabled and cannot be chosen.
Use our TryIt Editor to experiment with selected and disabled attributes.
Browser Support
Notes
- The <option> tag must be nested inside <select> or <datalist>.
- Use selected to preselect an option.
- Use disabled to prevent certain options from being selected.
- For accessibility, the label attribute can provide a screen-reader-friendly name.
Conclusion
The <option> tag defines individual choices within a dropdown or list.
It is essential for creating dynamic, user-friendly selection interfaces in forms.
The <optgroup> tag is used to group related <option> elements inside a <select> drop-down.
It provides better organization and readability for long lists of options.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Optgroup Example</title>
</head>
<body>
<h2>Select a Fruit or Vegetable</h2>
<form action="/samples/form_processor.php" method="post">
<label for="items">Choose an item:</label><br>
<select name="items" id="items" required>
<optgroup label="Fruits">
<option value="apple">Apple</option>
<option value="banana">Banana</option>
</optgroup>
<optgroup label="Vegetables">
<option value="carrot">Carrot</option>
<option value="spinach">Spinach</option>
</optgroup>
<optgroup label="Unavailable" disabled>
<option value="tomato">Tomato</option>
</optgroup>
</select><br><br>
Output
Browser Output
You will see a drop-down list where options are grouped under headings like "Fruits" and "Vegetab
les."
The "Unavailable" group is disabled, so its options cannot be selected.
Try it in our TryIt Editor to explore grouped selections.
Browser Support
Notes
Conclusion
The <label> tag is used to define a label for an HTML form control like <input>, <textarea>, or
<select>.
Clicking the label automatically focuses the associated form control, improving usability and
accessibility.
Associating labels with controls helps screen readers and improves user experience.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Label Example</title>
</head>
<body>
<h2>Login Form</h2>
<form action="/samples/form_processor.php" method="post">
<label for="username">Username:</label>
<input type="text" id="username" name="username" placeholder="Enter your username" required><
br><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password" placeholder="Enter your password" requir
ed><br><br>
Output
Browser Output
You will see a form with labels next to text and password fields.
Clicking on the Username or Password label focuses the respective input field.
Use our TryIt Editor to test how labels improve usability.
Browser Support
Notes
- Always use <label> for better accessibility.
- The for attribute must match the id of the input.
- Can be used with all types of inputs, including <textarea> and <select>.
- Reduces the chance of users clicking the wrong field.
Conclusion
The <label> tag is essential for accessible and user-friendly forms.
It ensures that users and assistive technologies can correctly associate form controls with their descriptions.
Syntax
[Link]
<fieldset>
<legend>Group Name</legend>
<!-- Form elements go here -->
</fieldset>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fieldset Example</title>
</head>
<body>
<h2>Registration Form</h2>
<form action="/samples/form_processor.php" method="post">
<fieldset>
<legend>Personal Information</legend>
<label for="fname">First Name:</label>
<input type="text" id="fname" name="fname" required><br><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
</fieldset><br>
<fieldset>
<legend>Account Details</legend>
<label for="username">Username:</label>
<input type="text" id="username" name="username" required><br><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
</fieldset><br>
Output
Browser Output
You will see two distinct sections in the form, each surrounded by a box with a legend at the top
.
The first box is "Personal Information," and the second is "Account Details."
Try it in our TryIt Editor to see the visual grouping and how it improves form readability.
Browser Support
Notes
- <fieldset> visually groups form fields and improves form semantics.
- Combine with <legend> for a caption describing the group.
- disabled can disable all fields in the group.
- Useful for long or complex forms to make them more readable.
Conclusion
The <fieldset> tag is ideal for grouping related form elements, making forms more organized and
user-friendly.
It enhances visual clarity and accessibility for users and assistive technologies.
The <legend> tag is used to provide a caption or title for a <fieldset> in a form.
It helps users understand the purpose of the grouped fields and improves form accessibility.
A <legend> must be the first child of a <fieldset> for proper display and semantics.
Syntax
[Link]
<fieldset>
<legend>Group Title</legend>
<!-- Form controls go here -->
</fieldset>
Attributes
Attribute Description
align (deprecated) Specifies the alignment of the legend text (left, center, right).
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Legend Example</title>
</head>
<body>
<h2>Survey Form</h2>
<form action="/samples/form_processor.php" method="post">
<fieldset>
<legend>Personal Details</legend>
<label for="name">Name:</label>
<input type="text" id="name" name="name" required><br><br>
<label for="age">Age:</label>
<input type="number" id="age" name="age" required>
</fieldset><br>
<fieldset>
<legend>Preferences</legend>
<label for="color">Favorite Color:</label>
<input type="text" id="color" name="color"><br><br>
<label for="hobby">Hobby:</label>
<input type="text" id="hobby" name="hobby">
</fieldset><br>
Output
Browser Output
You will see a fieldset with a caption at the top, e.g., "Personal Details" or "Preferences."
The legend clearly labels the grouped form fields.
Try it in our TryIt Editor to see how the legend improves form clarity and accessibility.
Browser Support
Notes
- <legend> should always be the first element inside <fieldset>.
- Provides a visual and semantic description of the fieldset.
- Improves accessibility, especially for screen readers.
- Deprecated attributes like align should be avoided; use CSS for styling instead.
Conclusion
The <legend> tag enhances form organization and readability by labeling fieldsets.
It is widely supported and crucial for accessible web forms.
The <datalist> tag is used to provide a list of predefined options for an <input> element.
It allows users to type a value or select from a list, offering a flexible and user-friendly input
experience.
The <datalist> element must be linked to an <input> using the list attribute.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Datalist Example</title>
</head>
<body>
<h2>Choose Your Favorite Browser</h2>
<form action="/samples/form_processor.php" method="post">
<label for="browser">Browser:</label>
<input list="browsers" id="browser" name="browser" placeholder="Start typing..." required>
<datalist id="browsers">
<option value="Chrome">
<option value="Firefox">
<option value="Edge">
<option value="Safari">
<option value="Opera">
<option value="Internet Explorer">
</datalist><br><br>
Output
Browser Output
You will see a text input where users can either type or select a value from a suggested dropdown
list.
As the user types, matching options appear for selection.
Try it in our TryIt Editor to see how <datalist> enhances form input.
Browser Support
Notes
- The <datalist> provides autocomplete suggestions but does not restrict input to only the listed
options.
- Must be linked to an <input> element via the list attribute.
- Improves user experience for forms with common or repetitive inputs.
- Works best for short lists; for very long lists, consider <select> instead.
Conclusion
The <datalist> tag creates a dynamic, user-friendly input experience.
It is widely supported and enhances form usability by providing autocomplete suggestions.
The <output> tag is used to display the result of a calculation or user action in a form.
It is commonly used with JavaScript to show dynamic results like sums, percentages, or other
computed values.
The <output> element is often linked to one or more input elements using the for attribute.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Output Tag Example</title>
</head>
<body>
<h2>Sum Calculator</h2>
<form oninput="[Link] = parseInt([Link]) + parseInt([Link])">
<label for="num1">Number 1:</label>
<input type="number" id="num1" value="">
<br>
<label for="num2">Number 2:</label>
<input type="number" id="num2" value="">
<br>
<br>
Output = <output name="result" for="num1 num2"></output>
</form>
</body>
</html>
Browser Support
Notes
- The <output> element is designed for displaying calculated results.
- Can be linked to one or more inputs using the for attribute.
- Supports dynamic updates via JavaScript.
- Improves form clarity by showing real-time results without additional labels.
Conclusion
The <output> tag is useful for displaying results in forms dynamically.
It provides a semantic way to show calculations or other computed outputs in modern HTML.
The <meter> tag is used to represent a scalar measurement within a known range, such as disk
usage, battery level, or progress percentage.
It is different from <progress>, as it can show a measurement that is not necessarily complete, but
has a min and max value.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Meter Tag Example</title>
</head>
<body>
<h2>Battery Level</h2>
<label for="battery">Battery:</label>
<meter id="battery" value="65" min="0" max="100" low="20" high="80" optimum="90">
65%
</meter>
<p>The battery level is at 65%.</p>
</body>
</html>
Browser Support
Notes
- <meter> is semantic for measurements and can be styled using CSS.
- Use low, high, and optimum to indicate different levels visually.
- Not supported in older Internet Explorer versions.
- Can be combined with <label> or <output> for more descriptive forms.
Conclusion
The <meter> tag provides a visual representation of scalar data within a defined range.
It improves usability and accessibility for displaying measurements like battery levels, scores, or progress
indicators.
The <progress> tag is used to display the progress of a task such as file uploads, downloads, or
other operations.
Unlike <meter>, <progress> represents completion of a task rather than a general measurement.
The value attribute shows the current progress, and max defines the total amount.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Progress Tag Example</title>
</head>
<body>
<h2>File Upload</h2>
<label for="fileUpload">Upload Progress:</label>
<progress id="fileUpload" value="45" max="100">45%</progress>
<p>Upload is at 45%.</p>
</body>
</html>
Browser Support
Notes
- <progress> is designed specifically to show task completion.
- The value must be less than or equal to max; otherwise, the bar may appear full.
- Can be styled using CSS for custom colors and sizes.
- Can be used in combination with <label> or <output> for more descriptive feedback.
Conclusion
The <progress> tag provides a clear visual indicator of task completion.
It enhances user experience for uploads, downloads, or any measurable process on modern websites.
The <header> tag represents a container for introductory content or navigational links.
It usually contains headings, logos, and main navigation links, but it can appear multiple times on a
page (e.g., for sections or articles).
Syntax
[Link]
<header>
<!-- Introductory content like logo, navigation, heading -->
</header>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Header Tag Example</title>
</head>
<body>
<header style="background-color: #f0f0f0; padding: 20px;">
<h1>My Website</h1>
<nav>
<a href="#">Home</a> |
<a href="#">About</a> |
<a href="#">Contact</a>
</nav>
</header>
<main>
<h2>Welcome to my website!</h2>
<p>This is an example showing the header element.</p>
</main>
</body>
</html>
Browser Support
Notes
- <header> is semantic, meaning it describes the role of the content for browsers and assistive
technologies.
- Can be used multiple times (for main header and section headers).
- Enhances SEO and accessibility.
Conclusion
The <header> tag is ideal for introducing content or navigation areas.
It gives structure and semantic meaning to the top part of a webpage or section.
The <footer> tag represents a footer section for its nearest sectioning content (like <body>,
<article>, <section>).
It typically contains copyright info, author details, navigation links, or contact information.
Syntax
[Link]
<footer>
<!-- Footer content like copyright, links, contact info -->
</footer>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Footer Tag Example</title>
</head>
<body>
<main>
<h1>Welcome to My Website</h1>
<p>This is an example of semantic footer usage.</p>
</main>
Browser Support
Notes
- <footer> is semantic, providing meaning to the page structure.
- Can appear multiple times (e.g., for a main footer and individual articles).
- Helps improve SEO and accessibility.
- Can contain text, links, forms, or scripts.
Conclusion
The <footer> tag is ideal for bottom-of-page or section content, like copyright, contact, or links.
It adds semantic meaning and structural clarity to web pages.
The <article> tag represents self-contained content that can be independently distributed or reused,
such as a blog post, news article, or forum post.
It typically contains headings, paragraphs, images, and other related content.
<article> is ideal for content that makes sense on its own, even outside the context of the page.
Syntax
[Link]
<article>
<!-- Self-contained content like blog post or news article -->
</article>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Article Tag Example</title>
</head>
<body>
<h1>Blog Page</h1>
Browser Support
Notes
- <article> should be independent content suitable for syndication or reuse.
- Can contain headings, paragraphs, images, lists, and other HTML content.
- Helps improve SEO and accessibility.
- Can be nested inside <section> or <main> for better organization.
Conclusion
The <article> tag is essential for structuring self-contained content on web pages.
It provides semantic meaning and improves readability, SEO, and accessibility.
<section> is often used along with headings (<h1>-<h6>) to define logical blocks of content.
Syntax
[Link]
<section>
<!-- Thematically related content with heading -->
</section>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Section Tag Example</title>
</head>
<body>
<h1>Website Overview</h1>
Browser Support
Notes
- <section> is semantic and should contain a heading to describe its content.
- Useful for grouping related content logically.
- Can be nested inside <main> or <article> for structured layout.
- Improves accessibility and SEO by providing clear content divisions.
Conclusion
The <section> tag is ideal for organizing thematic content on a webpage.
It provides semantic meaning, improves readability, and helps search engines understand content
structure.
The <aside> tag defines content that is related to the main content but separate from it, like
sidebars, pull quotes, or additional information.
It is often used for tangentially related content such as advertisements, links, or notes.
<aside> helps distinguish supplementary content from the main content, improving semantic
structure.
Syntax
[Link]
<aside>
<!-- Supplementary content like sidebar, notes, ads -->
</aside>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Aside Tag Example</title>
<style>
main {
float: left;
width: 70%;
}
aside {
float: right;
width: 25%;
background-color: #f0f0f0;
padding: 10px;
border: 1px solid #ccc;
}
</style>
</head>
<body>
<main>
<h1>Main Content</h1>
<p>This is the primary content of the webpage. It contains the main article or topic.</p>
</main>
<aside>
<h3>Related Links</h3>
<ul>
<li><a href="#">Additional Resource 1</a></li>
<li><a href="#">Additional Resource 2</a></li>
</ul>
</aside>
</body>
</html>
Browser Support
Notes
- <aside> is semantic for tangential or supplementary content.
- Often used for sidebars, callouts, or related links.
- Can appear multiple times on a page.
- Helps improve readability, accessibility, and SEO by separating main and related content.
Conclusion
The <aside> tag is ideal for supplementary content that complements the main content.
It provides semantic meaning and a clear distinction between main and secondary information.
The <main> tag represents the dominant content of the <body> of a webpage.
It should contain content unique to the page, excluding repeated elements like headers, footers,
sidebars, or navigation links.
<main> helps assistive technologies and search engines quickly identify the primary content of the
page.
Syntax
[Link]
<main>
<!-- Primary page content -->
</main>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Main Tag Example</title>
</head>
<body>
<header>
<h1>Website Header</h1>
</header>
<footer>
<p>© 2025 My Website</p>
</footer>
</body>
</html>
Browser Support
Notes
- <main> should only appear once per page.
- Excludes repeated content like <header>, <footer>, and <aside>.
- Improves accessibility, allowing screen readers to jump directly to main content.
- Helps SEO by signaling primary content to search engines.
Conclusion
The <main> tag is essential for defining the main content of a webpage.
It provides semantic meaning, accessibility benefits, and clarity for both users and search engines.
Learn how the HTML <search> tag semantically identifies controls and content used for searching
or filtering.
The <search> tag represents a part of a document or application used for searching or filtering.
It is a semantic container for form controls or other search-related content and creates a search
landmark for assistive technologies.
Syntax
[Link]
<search>
<form action="/search">
<label for="query">Search:</label>
<input type="search" id="query" name="q">
<button type="submit">Search</button>
</form>
</search>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Search Tag Example</title>
<style>
search {
display: block;
max-width: 520px;
padding: 20px;
border: 1px solid #d7e2e5;
border-radius: 10px;
background-color: #f7fbfc;
}
search form {
display: flex;
align-items: end;
gap: 10px;
}
search label {
display: grid;
flex: 1;
gap: 6px;
font-weight: bold;
}
search input,
search button {
padding: 10px 12px;
border-radius: 6px;
}
search input {
border: 1px solid #9fb2b8;
}
search button {
border: 0;
background-color: #29AB87;
color: white;
cursor: pointer;
}
</style>
</head>
<body>
<h1>Search Our Tutorials</h1>
id="tutorial-query"
name="q"
placeholder="Enter HTML, CSS, or JavaScript"
>
</label>
<button type="submit">Search</button>
</form>
</search>
</body>
</html>
Browser Support
The <search> element has been supported across major modern browsers since October 2023. Internet
Explorer does not support its search-landmark semantics.
Notes
- Use <search> to contain controls or content related to a search or filtering operation.
- The element identifies search semantics; it does not perform the search by itself.
- A <search> can contain a <form>, but a form is not required for JavaScript-based filtering.
- Do not use <search> as the main container for search results. Results should normally remain in
the page's main content.
- The element has an implicit search landmark role, so adding role="search" is unnecessary in
supporting browsers.
- Use an accessible name such as aria-label when a page contains multiple search landmarks.
- Do not confuse <search> with <input type="search">; the element is a container, while the
input accepts a query.
- Both the opening and closing tags are required.
Conclusion
The <search> tag gives clear semantic meaning to search and filtering interfaces.
Use it around the controls for a site-wide search, page search, or filtering feature while keeping the resulting
content in the main page area.
The <details> tag is used to create a collapsible content block that the user can open or close.
It is often used for FAQs, additional information, or disclosure sections.
The <summary> tag is typically used inside <details> to define the visible heading that toggles the
content.
Syntax
[Link]
<details>
<summary>Title or heading</summary>
<!-- Hidden content that can be expanded -->
</details>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Details Tag Example</title>
</head>
<body>
<h1>Frequently Asked Questions</h1>
<details>
<summary>What is HTML?</summary>
<p>HTML (HyperText Markup Language) is the standard markup language for creating web pages.</
p>
</details>
<details open>
<summary>What is CSS?</summary>
<p>CSS (Cascading Style Sheets) is used to style and layout HTML content.</p>
</details>
</body>
</html>
Browser Support
Notes
- <details> provides interactive content without JavaScript.
- Works well for FAQs, hints, or optional content.
- The open attribute allows the block to be expanded by default.
- Styling can be applied with CSS for better appearance.
Conclusion
The <details> tag is perfect for collapsible content sections.
It enhances user experience by hiding non-essential information until needed and is semantically
meaningful.
The <summary> tag defines a visible heading for the <details> element.
It acts as a toggle button that the user can click to expand or collapse the content inside <details>.
The <summary> tag must be the first child of <details> to work correctly.
Syntax
[Link]
<details>
<summary>Click to expand</summary>
<!-- Hidden content that appears when summary is clicked -->
</details>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Summary Tag Example</title>
</head>
<body>
<h1>Interactive FAQ</h1>
<details>
<summary>What is JavaScript?</summary>
<p>JavaScript is a programming language used to make web pages interactive.</p>
</details>
<details>
<summary>What is HTML?</summary>
<p>HTML (HyperText Markup Language) is used to structure content on the web.</p>
</details>
</body>
</html>
Browser Support
Notes
- <summary> must be inside <details> to function.
- Provides a toggle mechanism without JavaScript.
- Can be styled using CSS for font, color, and icons.
- Improves usability and semantic meaning for collapsible content.
Conclusion
The <summary> tag is essential for creating interactive headings inside <details>.
It enhances user experience by making content collapsible while maintaining semantic HTML.
The <dialog> tag represents a dialog box or modal window that can contain interactive content such
as text, forms, or buttons.
It can be opened or closed using the open attribute or JavaScript methods.
The <dialog> element is ideal for creating pop-ups, confirmation boxes, or form modals without
external JavaScript libraries.
Syntax
[Link]
<dialog open>
Content goes here...
</dialog>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dialog Tag Example</title>
</head>
<body>
<h1>Dialog Tag Example</h1>
<script>
const dialog = [Link]("infoDialog");
const openBtn = [Link]("openBtn");
const closeBtn = [Link]("closeBtn");
Browser Support
Notes
- The dialog can be shown using .show() or .showModal() JavaScript methods.
- Use the ::backdrop CSS pseudo-element to style the overlay behind a modal dialog.
- The <dialog> element improves accessibility when used with focus management and ARIA roles.
- It is not supported in Internet Explorer.
Conclusion
The <dialog> tag is a modern and semantic way to create modal windows or popups.
It simplifies implementation compared to traditional JavaScript modals and provides built-in accessibility
and focus control.
Syntax
[Link]
Attributes
Attribute Description
Note: The datetime attribute helps search engines understand structured data, improving SEO.
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Time Tag Example</title>
</head>
<body>
<h1>HTML <time> Tag Example</h1>
<p>The seminar will start at <time datetime="2025-11-05T14:00">2:00 PM, November 5, 2025</time>
.</p>
</body>
</html>
Browser Support
All browsers support this <time> tag, but IE has limited support for this.
Notes
- The <time> tag does not change how text looks by default.
- It allows search engines and other applications to extract and understand time-based information.
- Always use ISO 8601 format for the datetime attribute (e.g., 2025-11-01T09:30).
- The tag improves SEO and accessibility for date and time content.
Conclusion
The <time> tag is a semantic and SEO-friendly way to represent dates and times.
It makes your web content more meaningful for both users and search engines, especially for event-based
or time-sensitive information.
The <noscript> tag defines alternative content that is displayed only when JavaScript is disabled in
the browser or when the browser does not support scripting.
Syntax
[Link]
<noscript>
Alternate content displayed if JavaScript is disabled.
</noscript>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>noscript Tag Example</title>
<script>
[Link]("<p>JavaScript is enabled in your browser.</p>");
</script>
</head>
<body>
<noscript>
<p>Your browser does not support JavaScript or it's disabled. Please enable JavaScript to vie
w the full content of this page.</p>
</noscript>
</body>
</html>
Browser Support
Notes
- The <noscript> element provides a fallback for non-JavaScript environments.
- It is often used for warnings, accessibility, or alternate content.
- Always ensure your website remains usable without JavaScript when possible.
- This tag works inside both <head> and <body> elements.
Conclusion
The <noscript> tag ensures your webpage remains accessible and informative even if JavaScript is
unavailable.
It helps maintain usability and accessibility standards, providing fallback content for all users.
The <slot> tag is a placeholder inside a Web Component that allows developers to pass external
content (light DOM) into the shadow DOM.
It helps in creating flexible and reusable custom elements where parts of the content can be
dynamically replaced.
Syntax
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Slot Tag Example</title>
</head>
<body>
<template id="user-card">
<style>
div {
border: 1px solid #ccc;
padding: 10px;
border-radius: 5px;
width: 200px;
font-family: Arial, sans-serif;
}
</style>
<div>
<h3><slot name="username">Guest User</slot></h3>
<p><slot name="description">No description available.</slot></p>
</div>
</template>
<script>
class UserCard extends HTMLElement {
constructor() {
super();
const template = [Link]("user-card").content;
const shadow = [Link]({ mode: "open" });
[Link]([Link](true));
}
}
[Link]("user-card", UserCard);
</script>
<user-card>
<span slot="username">Swapnil Raja</span>
<span slot="description">Web Developer & Designer</span>
</user-card>
</body>
</html>
Browser Support
Notes
- The <slot> tag is only meaningful when used inside a shadow DOM of a Web Component.
- You can define named slots using the name attribute and insert specific content using the
corresponding slot attribute in light DOM.
- Default slot content appears when no light DOM content is provided for that slot.
Conclusion
The <slot> tag enables content projection in Web Components, allowing external content to be inserted
dynamically.
It enhances the flexibility and reusability of custom elements in modern web development.
The <template> tag in HTML is used to define HTML fragments that are not rendered immediately
when a page loads.
Its content remains inactive until it is activated via JavaScript.
This makes it ideal for creating reusable content blocks such as cards, modals, or list items
dynamically.
Syntax
[Link]
<template id="templateID">
<!-- HTML content to be cloned later -->
</template>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Template Tag Example</title>
</head>
<body>
<h2>Template Example</h2>
<template id="user-template">
<div style="border:1px solid #ccc; padding:10px; margin:5px; border-radius:5px;">
<h3>User: <span class="name"></span></h3>
<p>Role: <span class="role"></span></p>
</div>
</template>
<div id="user-container"></div>
<script>
const users = [
{ name: "Swapnil Raja", role: "Web Developer" },
{ name: "Alissha", role: "Principal" }
];
[Link](user => {
const clone = [Link](true);
[Link](".name").textContent = [Link];
[Link](".role").textContent = [Link];
[Link](clone);
});
</script>
</body>
</html>
Browser Support
Notes
- The <template> element is not displayed when the page loads.
- It is commonly used to create client-side templates that can be cloned and inserted into the DOM
using JavaScript.
- Content inside <template> remains inactive - scripts inside it won't execute, and images won't
load until inserted into the DOM.
Conclusion
The <template> tag provides a powerful and efficient way to define reusable and hidden HTML
structures that can be dynamically rendered using JavaScript.
It is an essential tool for building modular, component-based, and interactive web applications.
The experimental <shadow> element from Shadow DOM v0 is obsolete and unsupported.
The <shadow> element was an experimental insertion point from the old Shadow DOM v0 model. It
is obsolete, is not part of current HTML, and must not be used.
Standards Status
Item Status
Historical Syntax
You may encounter this markup in old experiments. Modern browsers do not provide the original Shadow
DOM v0 behavior.
<shadow></shadow>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Modern Shadow DOM Example</title>
</head>
<body>
<div id="host"></div>
<script>
const host = [Link]("host");
const shadowRoot = [Link]({ mode: "open" });
[Link] = "<p>This content is inside a modern shadow root.</p>";
</script>
</body>
</html>
<div>
<template shadowrootmode="open">
<style>p { color: teal; }</style>
<p>This content is inside a declarative shadow root.</p>
</template>
</div>
Important Points
- Do not use the obsolete <shadow> element.
- Use attachShadow() to create a shadow root with JavaScript.
- Use <slot> for content insertion inside a modern shadow tree.
- Use <template shadowrootmode> when declarative shadow DOM is appropriate.
Conclusion
The old <shadow> tag should appear only in historical documentation. Modern projects should use the
current Shadow DOM API, slots, or declarative shadow DOM.
Syntax
[Link]
<center>Content to be centered</center>
Attributes
Attribute Description
None The <center> tag does not have any specific attributes.
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Center Tag Example</title>
</head>
<body>
<center>
<p>This paragraph is centered using the deprecated <center> tag.</p>
</center>
</body>
</html>
Browser Support
Notes
- The <center> tag is deprecated and may be removed in future HTML versions.
- Use CSS text-align: center; for proper, modern web standards.
- This tag only affects horizontal alignment of inline and block content.
Conclusion
The <center> tag was historically used for horizontal alignment but is obsolete.
Modern web design should always use CSS for centering content.
The <font> tag was historically used to change the font face, size, and color of text in HTML.
It is deprecated in HTML5, and modern web design uses CSS (font-family, font-size, color) instead.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Font Tag Example</title>
</head>
<body>
<p>
<font face="Arial" size="4" color="blue">
This text is Arial, size 4, and blue using the deprecated <font> tag.
</font>
</p>
</body>
</html>
Browser Support
Notes
- The <font> tag is obsolete and should not be used in modern HTML.
- CSS properties provide a more flexible and standardized approach for text styling.
- Deprecated tags like <font> may still work in modern browsers for backward compatibility, but
using them is not recommended.
Conclusion
The <font> tag was once used to style text directly in HTML, but it is deprecated.
For maintainable and modern web design, always use CSS for text styling.
The <big> tag was used to increase the font size of text by one level relative to the surrounding text.
It is deprecated in HTML5, and CSS (font-size) should be used for controlling text size in modern
web development.
Syntax
[Link]
<big>Text</big>
Attributes
Attribute Description
None The <big> tag does not have any specific attributes.
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Big Tag Example</title>
</head>
<body>
<p>This is normal text, but <big>this text is slightly bigger</big> than the surrounding text.</p
>
</body>
</html>
Browser Support
Notes
- The <big> tag is obsolete and should not be used in modern HTML.
- CSS offers more precise control over font size.
- It only increases the text size relative to surrounding text, not by a specific absolute size.
Conclusion
The <big> tag is a deprecated HTML element for enlarging text.
Modern web design should always use CSS font-size for styling text.
The <strike> tag was historically used to display text with a strikethrough (line through the text).
It is deprecated in HTML5.
The modern standard uses the or <s> tags or CSS text-decoration: line-through; to achieve the
same effect.
Syntax
[Link]
Attributes
Attribute Description
None The <strike> tag does not have any specific attributes.
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Strike Tag Example</title>
</head>
<body>
</body>
</html>
Browser Support
Notes
- The <strike> tag is obsolete in HTML5.
- <del> or <s> should be used for semantic correctness (e.g., <del> indicates deleted content).
- CSS text-decoration: line-through; provides more flexible styling for strikethrough
effects.
Conclusion
The <strike> tag was used to create strikethrough text but is deprecated.
Modern HTML development should rely on semantic tags (<del> / <s>) or CSS for strikethrough styling.
Syntax
[Link]
<tt>Monospaced text</tt>
Attributes
Attribute Description
None The <tt> tag does not have any specific attributes.
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TT Tag Example</title>
</head>
<body>
</body>
</html>
Browser Support
Notes
- The <tt> tag is obsolete in HTML5.
- Use CSS for styling monospaced text instead, for example:
[Link]
p { font-family: monospace; }
Conclusion
The <tt> tag once displayed text in a fixed-width font but is now deprecated.
Use CSS or semantic tags like </strong> for modern and standards-compliant web
development.
The <acronym> tag in HTML was used to define an acronym - a word formed from the initial letters
of other words, such as NASA or HTML.
When a user hovered over the acronym, the browser could display its full meaning using the title
attribute.
This tag is deprecated in HTML5 and replaced by the tag.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Acronym Tag Example</title>
</head>
<body>
<p>
The <acronym title="HyperText Markup Language">HTML</acronym>
defines the structure of web pages.
</p>
</body>
</html>
Browser Support
Notes
- The <acronym> tag is deprecated in HTML5.
- Use the <abbr> tag instead, which provides the same functionality and is supported by modern
browsers.
- The title attribute is what displays the tooltip on hover.
Conclusion
The <acronym> tag was once used to define acronyms in HTML documents, but it is now obsolete.
For modern, accessible, and valid HTML, use the <abbr> tag instead.
The <applet> tag in HTML was used to embed Java applets (small Java programs) into a web page.
Applets could display interactive graphics, animations, or run other Java-based functionalities
directly within the browser.
However, the <applet> tag is deprecated in HTML5 and should no longer be used - it has been
replaced by the <object> or <embed> tag.
Syntax
[Link]
Attributes
Attribute Description
codebase Defines the base URL for the applet's class files.
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Applet Tag Example</title>
</head>
<body>
<p><strong>Note:</strong> Modern browsers no longer support Java applets. Use the <object> tag in
stead.</p>
</body>
</html>
Browser Support
No No No No No Partially
No browser support this <applet> tag now except of some older version of IE.
Notes
- The <applet> tag was officially deprecated in HTML 4.01 and removed in HTML5.
- Java plug-ins are now considered insecure and have been removed from most browsers.
- For modern replacements, use <object>, <embed>, or JavaScript-based web apps.
Conclusion
The <applet> tag was used to embed Java programs directly into web pages but is now obsolete.
Modern web development standards have replaced it with safer and more compatible technologies like
JavaScript, <object>, <embed>, or WebAssembly.
The <frame> tag in HTML was used to define a specific region within a <frameset> that could
display a separate HTML document.
Frames allowed web developers to split the browser window into multiple sections, each loading a
different webpage.
This tag is deprecated in HTML5 and replaced by more modern layout techniques using CSS
Flexbox, Grid, or iframes.
Syntax
[Link]
<frameset cols="50%,50%">
<frame src="[Link]">
<frame src="[Link]">
</frameset>
Attributes
Attribute Description
marginwidth Sets the left and right margins of the frame content.
marginheight Sets the top and bottom margins of the frame content.
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Frame Tag Example</title>
</head>
<noframes>
<body>
<p>Your browser does not support frames. Please use a modern browser.</p>
</body>
</noframes>
</html>
Browser Support
Notes
- The <frame> tag cannot be used inside the <body> tag - it must be used within a <frameset>.
- Frames are deprecated due to accessibility, usability, and SEO issues.
- Use CSS layouts or <iframe> for embedding external content instead.
Conclusion
The <frame> tag was once used to divide a webpage into multiple sections displaying separate documents.
It is now obsolete in HTML5 and replaced by modern layout methods like CSS Grid, Flexbox, or
embedding techniques using <iframe>.
The <frameset> tag in HTML was used to define a set of frames within the browser window. It
allowed you to divide the window into multiple sections (frames), each displaying a separate HTML
document.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>HTML Frameset Example</title>
</head>
<frameset cols="50%,50%">
<frame src="[Link] name="leftFrame">
<frame src="[Link] name="rightFrame">
</frameset>
</html>
Output
Browser Output
This example divides the browser window into two vertical frames:
(Note: In modern browsers, this will not work, as <frameset> and <frame> are deprecated.)
Browser Support
The <frameset> tag is partially supported by few browser's older version but most of the browser dosn't
support this tag.
Notes
- The <frameset> tag replaced the <body> tag in documents that used frames.
- Each frame could display a different webpage.
Conclusion
The <frameset> tag was once a useful feature for creating multi-document layouts, but it is deprecated
and obsolete in modern web development. Developers should now use CSS layout techniques or iframes
for embedding content instead of using framesets.
The <noframes> tag in HTML was used to provide alternative content for browsers that do not
support frames.
When a webpage used the <frameset> element to divide the browser window into multiple frames,
the <noframes> tag offered fallback content (like a message or simple links) for users whose
browsers couldn't display frames or had frames disabled.
Note: The <noframes> tag is deprecated in HTML5. Modern browsers support frames, and modern
webpage structures use <iframe> or responsive layouts instead.
Syntax
<noframes>
Alternative content goes here...
</noframes>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>Example of noframes Tag</title>
</head>
<frameset cols="50%,50%">
<frame src="[Link]
<frame src="[Link]
<noframes>
<body>
<p>Your browser does not support frames. Please visit
<a href="[Link] 1</a> or
<a href="[Link] 2</a> manually.</p>
</body>
</noframes>
</frameset>
</html>
Output
Browser Output
Browser Support
Notes
- The <noframes> tag should always be used inside a <frameset> block.
- It is mainly useful for very old browsers that do not support frames.
- Modern web design practices no longer use frames or noframes.
- If you need fallback content, consider using CSS-based layouts and <iframe> with accessible
messaging instead.
Conclusion
The <noframes> tag was introduced as a fallback mechanism for browsers that could not render frames.
While it still displays content in some browsers for legacy support, it is obsolete in HTML5.
Developers should use responsive layouts, semantic HTML elements, and <iframe> for embedding
content instead of relying on frames or noframes.
The <marquee> tag in HTML was used to create scrolling text or images that move horizontally or
vertically across a webpage.
It was often used to attract attention with moving announcements, news tickers, or advertisements.
Note: The <marquee> tag is deprecated in HTML5 and should not be used in modern web
development.
The same effect can be achieved using CSS animations or JavaScript for better control and
accessibility.
Syntax
[Link]
Attributes
behavior Defines how the marquee text scrolls. scroll (default), slide, alternate
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>Example of marquee Tag</title>
</head>
<body>
</body>
</html>
Output
Browser Output
Browser Support
Notes
- The <marquee> tag is non-standard and not part of the official HTML5 specification.
- It can cause accessibility and usability issues for screen readers and users with motion sensitivity.
- Use CSS animations instead. For example:
[Link]
<style>
.scroll-text {
display: inline-block;
white-space: nowrap;
animation: scroll-left 10s linear infinite;
}
@keyframes scroll-left {
from { transform: translateX(100%); }
to { transform: translateX(-100%); }
}
</style>
Conclusion
The <marquee> tag was once a popular way to add scrolling effects to text or images, but it is now
deprecated and obsolete in HTML5.
Modern web developers should use CSS animations or JavaScript for smooth, accessible scrolling effects.
The <blink> tag in HTML was used to make enclosed text blink or flash on and off continuously on
the screen.
It was introduced in Netscape Navigator browsers in the 1990s as a visual attention grabber for
important text or warnings.
Note: The <blink> tag is deprecated and not supported in HTML5 or modern browsers.
The blinking effect can be recreated using CSS animations or JavaScript.
Syntax
[Link]
Attributes
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>Example of blink Tag</title>
</head>
<body>
</body>
</html>
Browser Support
Notes
- The <blink> tag is completely obsolete and should never be used in modern HTML documents.
- The blinking effect can cause accessibility issues for users with epilepsy or visual sensitivity.
- To achieve a similar blinking effect safely, use CSS animations:
[Link]
<style>
.blink {
animation: blink-effect 1s step-start infinite;
color: red;
font-weight: bold;
}
@keyframes blink-effect {
50% { opacity: 0; }
}
</style>
Conclusion
The <blink> tag was once used to create a flashing text effect, but it is deprecated and no longer
supported by any modern browsers.
For modern, accessible websites, use CSS animations instead to simulate blinking or highlight text in a
more user-friendly way.
The <s> tag in HTML is used to define text that is no longer correct, accurate, or relevant but should
not be deleted.
It visually renders text with a strikethrough line, similar to , but <s> is meant for stylistic or factual
changes rather than indicating document edits.
Syntax
[Link]
Attributes
Attribute Description
The <s> tag does not have any specific attributes. However,
None
global attributes like class, id, and style can be used.
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML <s> Tag Example</title>
</head>
<body>
<h2>HTML <s> Tag Example</h2>
<p>Original Price: <s>999</s> Now only 599!</p>
<p>Old information: <s>Registration closes on June 1.</s> Extended till June 10!</p>
</body>
</html>
Browser Support
Notes
- Use <s> when you want to show stylistically outdated or incorrect information, such as an old
price or an outdated reference.
- For marking deleted or removed text in document revisions, use the <del> tag instead.
Conclusion
The <s> tag is a simple yet effective way to visually indicate that text content is obsolete or incorrect. It helps
improve user clarity while keeping the content visible for reference.
Syntax
[Link]
<var>variable_name</var>
Attributes
Attribute Description
The <var> tag does not support any specific attributes other
None
than the global and event attributes.
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>HTML var Tag Example</title>
</head>
<body>
<h2>HTML <var> Tag Example</h2>
<p>The area of a rectangle is <var>length</var> <var>width</var>.</p>
<p>In the equation <var>x</var> + <var>y</var> = 10, <var>x</var> and <var>y</var> are variable
s.</p>
</body>
</html>
Browser Support
Notes
- The <var> element is purely semantic; it doesn't add any functional behavior - only meaning.
- It's mainly used in educational, scientific, or technical documents.
- You can style it differently with CSS if desired, e.g., change the color or font style.
- For code snippets or user input, use or <kbd> instead of <var>.
Conclusion
The <var> tag semantically represents a variable in code or mathematics, improving the readability and
accessibility of technical content.
Although it looks similar to italic text, it conveys specific meaning to browsers, assistive technologies, and
search engines.
Syntax
[Link]
<kbd>keyboard input</kbd>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>HTML kbd Tag Example</title>
</head>
<body>
<h2>HTML <kbd> Tag Example</h2>
<p>To open the command prompt, type <kbd>cmd</kbd> in the Run dialog.</p>
</body>
</html>
Browser Support
Since <kbd> is visible inline content, you can easily see the output in your browser.
Try it in our TryIt Editor to observe how the keyboard-style formatting appears.
Notes
- <kbd> is used for keyboard input, while <samp> is for sample output, and is for
<strong>code snippets</strong>.
- It improves semantics for tutorials and accessibility tools.
- You may style it with CSS for custom keyboard-like UI boxes.
Conclusion
The <kbd> element is perfect for displaying keyboard shortcuts or user input commands clearly and
semantically.
It enhances readability in tutorials and helps users identify instructions quickly.
The <samp> tag is used to represent sample output from a computer program, system, or device.
Browsers typically display <samp> text in a monospace font, similar to how code or terminal output
appears.
Syntax
[Link]
<samp>sample output</samp>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>HTML samp Tag Example</title>
</head>
<body>
<h2>HTML <samp> Tag Example</h2>
<p>Another example:</p>
</body>
</html>
Browser Support
Notes
- <samp> is for program/system output, while <kbd> is for user input, and is for code
examples.
- Great for tutorials, documentation, and examples that simulate command-line output.
- You can style it with CSS to create a terminal-like appearance.
Conclusion
The <samp> tag helps display system-generated messages in a clear and semantic way.
It improves the readability of technical documentation and makes program outputs easy to identify.
HTML Tag
The tag is used to display a fragment of computer code in a monospace (fixed-width) font.
It is typically used for inline code, not for large code blocks.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>HTML Code Tag Example</title>
</head>
<body>
</body>
</html>
Browser Support
Notes
- For multi-line code, wrap inside a <pre> tag.
- For semantic clarity, use <kbd>, <samp>, or <var> when appropriate.
Conclusion
The tag is essential for displaying small pieces of code or commands in a
readable monospace format. It improves clarity and is widely supported across
all browsers.
The <dfn> tag identifies the defining instance of a term or concept within a document.
It is used the first time a term appears, usually alongside its explanation. Browsers may style it in
italics by default, but the real purpose is semantic - helping search engines, accessibility tools, and
documentation systems understand term definitions.
Syntax
[Link]
Attributes
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>DFN Tag Example</title>
</head>
<body>
<p>
<dfn>HTML</dfn> is a markup language used to structure content on the web.
</p>
</body>
</html>
Browser Support
Notes
- <dfn> marks only the defining occurrence of a term - later references should not use <dfn>.
- Screen readers may announce it as a "definition", improving accessibility.
- Often combined with <abbr> when defining abbreviations.
- Purely semantic - does not add styling unless styled with CSS.
Conclusion
The <dfn> tag adds meaningful structure by identifying the first definition of a term in your content. It's
simple but valuable for documentation, accessibility, and SEO. Use it whenever you introduce important
vocabulary or concepts.
Syntax
[Link]
<div>
Content goes here...
</div>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>DIV Example</title>
<style>
.box {
width: 200px;
padding: 20px;
background-color: lightblue;
border: 2px solid #333;
margin-bottom: 20px;
}
</style>
</head>
<body>
<h2>DIV Example</h2>
<div class="box">
This is a content box inside a DIV.
</div>
<div class="box">
Another DIV with the same CSS class.
</div>
</body>
</html>
Browser Support
Notes
- <div> is a block-level element; it starts on a new line.
- It is the most common container for CSS layout design.
- In modern HTML5, semantic elements like <header>, <section>, <article>, <footer>, etc.
are preferred over <div> for structure.
- <div> should be used mainly as a generic container when no semantic element fits.
Conclusion
The <div> tag is a fundamental block container used to group and style HTML content. While newer
semantic tags provide meaning, <div> remains essential for layout and design due to its flexibility.
HTML Tag
The tag is an inline container used to group text or elements for styling with CSS or to apply
JavaScript functionality.
Unlike <div>, does not create a new block; it is inline and does not affect the layout by itself.
Syntax
[Link]
Attributes
Attribute Description
Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML span Tag Example</title>
<style>
.highlight {
color: red;
font-weight: bold;
}
</style>
</head>
<body>
<h2>HTML <span> Tag Example</h2>
<p>This is a normal text and <span class="highlight">this part is highlighted using span</span>
.</p>
<p>Hover over this <span title="This is a tooltip">tooltip text</span> to see the title attribu
te.</p>
</body>
</html>
Output
Browser Output
The text inside <span> can be styled or manipulated without affecting the layout of other element
s.
Inline styling or class-based CSS changes apply only to the content within the <span>.
Browser Support
<span> itself does not create visual changes unless styled with CSS or manipulated via JavaScript.
Notes
- <span> is purely semantic/structural for inline grouping.
- Commonly used for applying CSS styles, attaching event listeners, or wrapping small portions of text.
- Use <span> for inline elements, and <div> for block-level containers.
Conclusion
The <span> tag is a versatile inline container in HTML, perfect for applying styles or behavior to a portion of
text without disrupting the flow of the document.
HTML comments are used to insert notes or explanations in the HTML code that are not displayed
in the browser.
Comments are helpful for developers to document code, temporarily disable code, or leave
reminders.
Syntax
[Link]
Attributes
The HTML comment tag does not support any attributes. Only the content inside <!-- --> is
recognized as a comment.
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML Comment Example</title>
</head>
<body>
<h2>HTML Comment Example</h2>
<!-- This is a comment and will not be displayed in the browser -->
<p>This paragraph is visible to the user.</p>
<!--
Multiple line comment:
1. This is a note for developers.
2. Can temporarily disable code.
-->
<p>This paragraph is also visible.</p>
</body>
</html>
Browser Support
Comments do not appear in the rendered page, but they are visible in the page source.
Notes
- Comments can be used for code documentation, debugging, or temporarily removing code.
- Nested comments are not allowed; HTML does not support <!-- <!-- nested --> -->.
- Avoid leaving sensitive information in comments, as they are visible in the page source.
Conclusion
The HTML comment tag is a developer-only tool for leaving notes or disabling code temporarily. It does not
affect the visual layout of the page and is fully supported in all browsers.
The <data> tag is used to associate machine-readable data with human-readable content.
It allows the browser or scripts to understand the value of a text while still displaying a friendly
version to users.
Syntax
[Link]
Attributes
Attribute Description
(Global Attributes) class, id, style, title, etc. can also be used.
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML data Tag Example</title>
</head>
<body>
<h2>HTML <data> Tag Example</h2>
Browser Support
Only the human-readable content is displayed; the value attribute is for scripts or programs.
Notes
- <data> is semantic and improves accessibility and SEO by providing machine-readable values.
- Can be used with JavaScript for calculations, data processing, or structured content.
- Works well for dates, numbers, currency, or any data that needs to be machine-readable but
human-friendly.
Conclusion
The <data> tag allows developers to link human-readable text with a machine-readable value,
enhancing semantic meaning and interactivity without changing what the user sees.
Learn how the HTML <ruby>, <rt>, and <rp> elements create pronunciation and explanatory
annotations with fallback punctuation.
HTML ruby annotations display short pronunciation or explanatory text alongside base text,
especially in East Asian typography.
The <ruby> element wraps the annotation, <rt> provides the annotation text, and <rp> provides
fallback punctuation for browsers that cannot display ruby annotations.
Syntax
[Link]
<ruby>
<rp>(</rp>
<rt>kan</rt>
<rp>)</rp>
</ruby>
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ruby Annotation Example</title>
<style>
body {
font-family: Arial, sans-serif;
padding: 30px;
}
ruby {
font-size: 2rem;
}
rt {
color: #007a96;
font-size: 0.55em;
}
</style>
</head>
<body>
<h1>Japanese Ruby Annotation</h1>
<p>
<ruby>
<rp>(</rp><rt>kan</rt><rp>)</rp>
<rp>(</rp><rt>ji</rt><rp>)</rp>
</ruby>
means "Chinese characters."
</p>
</body>
</html>
Browser Support
The <ruby>, <rt>, and <rp> elements are supported by all major modern browsers.
Notes
- Place the base text and its annotation inside <ruby>.
- Use <rt> as a child of <ruby> to provide pronunciation, transliteration, translation, or another short
annotation.
- Place <rp> immediately before or after <rt> to provide fallback punctuation, usually parentheses.
- Browsers with ruby support hide the <rp> text and position the <rt> annotation beside the base
text.
- A single <ruby> element can contain more than one base-text and annotation pair.
- The <ruby> closing tag is required. Although some <rt> and <rp> end tags may be omitted in
limited cases, writing them explicitly keeps the markup clear.
Conclusion
The <ruby>, <rt>, and <rp> elements work together to create readable ruby annotations with a text
fallback.
Use them for short pronunciation or explanatory annotations that belong directly with the base text.
The <svg> tag is used to embed Scalable Vector Graphics (SVG) directly inside an HTML
document.
SVG graphics are resolution-independent, meaning they scale without losing quality and are ideal
for icons, diagrams, charts, and illustrations.
SVG elements are part of the HTML5 specification and work seamlessly with CSS and JavaScript.
Syntax
[Link]
Attributes
Attribute Description
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>SVG Tag Example</title>
</head>
<body>
<h2>SVG Example</h2>
</body>
</html>
Browser Support
Notes
- SVG graphics are DOM elements, so they can be styled with CSS and manipulated with JavaScript.
- SVG is different from <canvas> - SVG is vector-based, canvas is pixel-based.
- Inline SVG is preferred over image-based SVG for better interactivity and styling.
Conclusion
The <svg> tag enables powerful, scalable, and interactive vector graphics in HTML.
It is an essential modern web technology for icons, visualizations, and responsive design.
The <basefont> tag was used to define a default font size, color, and font face for all text in an
HTML document.
Once set, all text on the page inherited these font properties unless overridden by other tags.
Syntax
[Link]
Attributes
Attribute Description
size Sets the base font size (1-7 or relative values like +1)
Example
[Link]
<!DOCTYPE html>
<html>
<head>
<title>Basefont Tag Example</title>
</head>
<body>
</body>
</html>
Browser Support
Notes
- <basefont> affects the entire document globally.
- It was replaced by CSS font rules like:
- Deprecated due to lack of flexibility and poor separation of content and style.
[Link]
body {
font-family: Arial;
font-size: 16px;
color: blue;
}
Conclusion
The <basefont> tag was an early attempt at global text styling in HTML but is now obsolete.
Modern websites should always use CSS for font control, consistency, and responsiveness.