HTML Tags1
HTML Tags1
These cover
the foundational elements you'll need when creating a webpage.
✅ 1. <!DOCTYPE html>
Declares the document type and HTML version.
<!DOCTYPE html>
✅ No visual output. It's just a declaration.
✅ 2. <html>
Root element of an HTML page.
<html>
</html>
✅ Wraps the entire page content.
✅ 3. <head>
Contains meta-information, links, title, etc.
<head>
<title>My Page</title>
</head>
✅ No visible output, but the title appears in the browser tab.
✅ 4. <body>
✅ 5. <h1> to <h6>
Headings from biggest (<h1>) to smallest (<h6>)
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
✅ Output:
Heading 1
Heading 2
Heading 3
✅ 6. <p>
Paragraph tag
<p>This is a paragraph.</p>
✅ Output:
This is a paragraph.
✅ 7. <a>
Anchor (link) tag
✅ 8. <img>
Image tag (self-closing)
<img src="https://via.placeholder.com/100" alt="Placeholder Image">
✅ Output:
<ol>
<li>First</li>
<li>Second</li>
</ol>
✅ Output:
Apple
Banana
✅ 10. <div>
Block-level container
<div>This is a container</div>
✅ Output:
This is a container
✅ 11. <span>
Inline container
<span style="color: red;">Red Text</span>
✅ Output:
Red Text
✅ 14. <br>
Line break
Hello<br>World
✅ Output:
Hello
World
✅ 15. <hr>
Horizontal rule (divider)
And here are more useful and commonly used HTML tags, especially helpful for
structuring, media, semantic layout, and styling.
✅ 17. <mark>
Highlights text.
<p>This is <mark>important</mark>!</p>
✅ Output:
This is important!
✅ 18. <code>
✅ 19. <pre>
Preformatted text (preserves spaces & line breaks).
<pre>
Line 1
Line 2
Line 3
</pre>
✅ Output:
Line 1
Line 2
Line 3
✅ 20. <video>
Embeds a video.
<video controls width="250">
<source src="movie.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
✅ 21. <audio>
Embeds audio.
<audio controls>
<source src="audio.mp3" type="audio/mpeg">
Your browser does not support the audio tag.
</audio>
✅ Output:
An audio player (if audio.mp3 is present).
✅ 22. <iframe>
Embed another page, video, or map.
<iframe src="https://example.com" width="300" height="200"></iframe>
✅ Output:
An embedded website.
✅ 23. <nav>
For navigation menus (semantic).
<nav>
<a href="/">Home</a> |
<a href="/about">About</a>
</nav>
<footer>
<p>Copyright © 2025</p>
</footer>
✅ Output:
Visually groups header/footer content.
✅ 27. <label>
Labels an input field (improves accessibility).
<label for="email">Email:</label>
<input type="email" id="email">
✅ Output:
Email: [__________]
✅ 29. <textarea>
Multi-line text input.
✅ 30. <meta>
Metadata like charset, viewport, description (used inside <head>).
<meta charset="UTF-8">
<meta name="description" content="This is a sample site.">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
✅ Output:
No visible output, but helps with SEO, mobile responsiveness, and encoding.
Now, interactive HTML tags — these are elements that allow user interaction, like
input fields, controls, and dynamic behavior (often used with JS later).
🔹 1. <input>
Different types of user input fields.
<input type="text" placeholder="Enter text">
🔹 2. <button>
Clickable button.
<button onclick="alert('Hello!')">Click Me</button>
✅ Output:
Clicking it shows: Hello!
🔹 3. <select> + <option>
Dropdown menu.
<select>
<option value="1">Apple</option>
<option value="2">Banana</option>
<option value="3">Mango</option>
🔹 4. <textarea>
Multi-line text box.
<textarea rows="3" cols="30">Type here...</textarea>
✅ Output:
A larger box for typing multiple lines.
🔹 5. <details> + <summary>
Expandable content (accordion-like).
<details>
<summary>Click to expand</summary>
<p>This is hidden text revealed on click.</p>
</details>
✅ Output:
A collapsible section with hidden content.
<button onclick="document.getElementById('myDialog').showModal()">Open
Dialog</button>
✅ Output:
Click "Open Dialog" → a modal appears.
🔹 7. <progress>
Progress bar.
<progress value="50" max="100"></progress>
✅ Output:
A progress bar halfway filled.
🔹 8. <meter>
Graphical gauge (like scores, temperatures, etc.)
<meter value="0.7">70%</meter>
✅ Output:
A colored bar indicating a level (70%).
🔹 9. <form> + Submit
Submits user input (default behavior refreshes page).
<form onsubmit="alert('Form submitted!'); return false;">
<input type="text" placeholder="Your name">
<button type="submit">Submit</button>
</form>
DEMO :
A complete HTML page with all the tags we've discussed — from basic structure to
interactive elements — including inline comments to help you understand what
each part does.
You can copy and paste this into any .html file and open it in your browser to see
the live output.
<ol>
<li>First</li>
<li>Second</li>
</ol>
<label>Password:</label>
<input type="password" placeholder="Enter password"><br><br>
<label>Gender:</label>
<input type="radio" name="gender"> Male
<input type="radio" name="gender"> Female<br><br>
<label>Choose Fruits:</label>
<input type="checkbox"> Apple
<input type="checkbox"> Banana<br><br>
<label>Date:</label>
<input type="date"><br><br>
<label>Color Picker:</label>
<input type="color"><br><br>
<label>Range (0-100):</label>
<input type="range" min="0" max="100"><br><br>
<label>Dropdown:</label>
<select>
<option>Apple</option>
<option>Banana</option>
<option>Mango</option>
</select><br><br>
<label>Comments:</label><br>
<textarea rows="4" cols="40">Type something here...</textarea><br><br>
<button type="submit">Submit</button>
</form>
<details>
<summary>Click to expand</summary>
<p>Video:</p>
<video width="250" controls>
<source src="movie.mp4" type="video/mp4">
Your browser does not support video.
</video><br><br>
<nav>
<a href="#">Home</a> |
<a href="#">About</a> |
<a href="#">Contact</a>
</nav>
<main>
<section>
<h3>News Section</h3>
<article>
<p>This is an article inside a section.</p>
</article>
<footer>
<p>© 2025 My Website</p>
</footer>
</body>
</html>
<nav>
<a href="#typography">Typography</a>
<a href="#formatting">Formatting</a>
<a href="#lists-tables">Lists & Tables</a>
<a href="#media">Media</a>
<a href="#forms">Forms</a>
<a href="#interactive">Interactive</a>
<a href="#layout">Layout</a>
</nav>
<section id="typography">
<h2>Typography</h2>
<h1>H1 Heading</h1>
<h2>H2 Heading</h2>
<h3>H3 Heading</h3>
<p>This is a paragraph with some <strong>bold</strong>, <em>italic</em>, and
<mark>highlighted</mark> text.</p>
<p>Inline code example: <code><div></code></p>
<section id="formatting">
<h2>Links & Images</h2>
<p>
Visit: <a href="https://example.com" target="_blank">Example.com</a><br>
<img src="https://via.placeholder.com/100" alt="Placeholder">
</p>
</section>
<section id="lists-tables">
<h2>Lists and Tables</h2>
<ul>
<li>Apple</li>
<li>Banana</li>
</ul>
<section id="media">
<h2>Media</h2>
<p>Video:</p>
<video width="300" controls>
<source src="movie.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
<p>Audio:</p>
<audio controls>
<source src="audio.mp3" type="audio/mpeg">
Your browser does not support the audio tag.
</audio>
</section>
<input type="date"><br><br>
<input type="color"><br><br>
<input type="range"><br><br>
<input type="file"><br><br>
<select>
<option>Apple</option>
<option>Banana</option>
</select><br><br>
<section id="interactive">
<h2>Interactive Elements</h2>
<button onclick="alert('Hello!')">Click Me</button><br><br>
<details>
<summary>Click to expand</summary>
<p>Hidden text revealed on click.</p>
</details><br>
<dialog id="myDialog">
<p>This is a dialog box.</p>
<button
onclick="document.getElementById('myDialog').close()">Close</button>
</dialog>
<button onclick="document.getElementById('myDialog').showModal()">Open
Dialog</button>
©GUVI Geek Network Private Limited
</section>
<section id="layout">
<h2>Semantic Layout</h2>
<header>
<h3>Header</h3>
</header>
<nav>
<a href="#">Home</a> |
<a href="#">About</a>
</nav>
<main>
<section>
<h4>News</h4>
<article>
<p>This is an article inside a section.</p>
</article>
</section>
<aside>
<p>This is an aside (sidebar).</p>
</aside>
<footer>
<p>© 2025 HTML Playground Project</p>
</footer>
</body>
</html>
💡 Tips:
You can enhance this further with CSS frameworks like Bootstrap or Tailwind.
Add JavaScript later for real-time input handling or dynamic UI.
Replace video/audio with real files or embed from YouTube.