Comprehensive HTML Cheatsheet

1. Basic Document Structure

<!DOCTYPE html> <html lang="en"> <head> <title>Page Title</title> </head> <body> <!-- Page content goes here --> </body> </html>

2. Text Formatting

<p>Paragraph text</p> <h1>Main Heading</h1> <h2>Subheading</h2> <strong>Bold Text</strong> <em>Italic Text</em> <u>Underlined Text</u> <mark>Highlighted Text</mark>

Paragraph text

Main Heading

Subheading

Bold Text Italic Text Underlined Text Highlighted Text

3. Lists

<!-- Unordered List --> <ul> <li>List Item 1</li> <li>List Item 2</li> </ul> <!-- Ordered List --> <ol> <li>First Item</li> <li>Second Item</li> </ol>
  1. First Item
  2. Second Item

4. Links and Navigation

<!-- External Link --> <a href="https://www.example.com">External Link</a> <!-- Internal Link --> <a href="#section">Internal Link</a> <!-- Navigation Menu --> <nav> <a href="#home">Home</a> <a href="#about">About</a> <a href="#contact">Contact</a> </nav>
External Link

5. Tables

<table border="1"> <thead> <tr> <th>Header 1</th> <th>Header 2</th> </tr> </thead> <tbody> <tr> <td>Row 1, Cell 1</td> <td>Row 1, Cell 2</td> </tr> </tbody> </table>
Header 1 Header 2
Row 1, Cell 1 Row 1, Cell 2

6. Forms

<form action="/submit" method="post"> <label for="name">Name:</label> <input type="text" id="name" name="name" required> <label for="email">Email:</label> <input type="email" id="email" name="email"> <label for="message">Message:</label> <textarea id="message" name="message"></textarea> <button type="submit">Submit</button> </form>



7. Multimedia

<!-- Image --> <img src="image.jpg" alt="Image Description"> <!-- Audio --> <audio controls> <source src="audio.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio> <!-- Video --> <video width="400" height="300" controls> <source src="video.mp4" type="video/mp4"> Your browser does not support the video element. </video>
Image Placeholder

8. Embedding

<!-- YouTube Embed --> <iframe width="560" height="315" src="https://www.youtube.com/embed/VIDEO_ID" allowfullscreen> </iframe>