All Cheat Sheets
HTML5

HTML Cheat Sheet

Document Structure

DOCTYPEDeclares HTML5 document type
<!DOCTYPE html>
Root elementWraps all page content
<html lang="en">
  ...
</html>
Head sectionContains metadata and links
<head>
  <meta charset="UTF-8">
  <title>Page Title</title>
</head>
Body sectionContains visible content
<body>
  <h1>Hello World</h1>
</body>

Common Elements

Headingsh1 to h6, h1 is most important
<h1>Main Heading</h1>
<h2>Subheading</h2>
ParagraphBlock of text
<p>This is a paragraph.</p>
LinkHyperlink to another page
<a href="https://example.com">Click Here</a>
ImageEmbeds an image
<img src="image.jpg" alt="Description">
ListOrdered and unordered lists
<ul>
  <li>Item 1</li>
  <li>Item 2</li>
</ul>
<ol>
  <li>First</li>
  <li>Second</li>
</ol>
Div & SpanGeneric block and inline containers
<div>Block container</div>
<span>Inline container</span>

Forms

Form elementWraps input fields
<form action="/submit" method="POST">
  ...
</form>
Text inputSingle-line text field
<input type="text" name="username" placeholder="Enter name">
ButtonSubmit or action button
<button type="submit">Submit</button>
LabelAssociates text with an input
<label for="email">Email:</label>
<input type="email" id="email" name="email">
SelectDropdown menu
<select name="country">
  <option value="in">India</option>
  <option value="us">USA</option>
</select>