Skip to content
DevNursery.com - New Web Developer Docs
GitHub

HTML Cheatsheet

HTML ElementPurposeExample Usage
<div>Container for grouping and styling elements<div class="container">Content</div>
<p>Paragraph text<p>This is a paragraph.</p>
<h1>, <h2>, …Headings (1 to 6 for varying levels)<h1>Main Heading</h1>
<a>Hyperlink<a href="https://example.com">Link</a>
<img>Image<img src="image.jpg" alt="Description">
<ul>, <ol>Unordered and Ordered Lists<ul><li>Item 1</li><li>Item 2</li></ul>
<li>List Item<li>List item 1</li>
<table>Table<table><tr><td>Cell 1</td></tr></table>
<form>Form for user input<form action="/submit" method="POST">...</form>
<input>Input field<input type="text" name="username">
<button>Button<button>Click me</button>
<textarea>Multiline text input<textarea rows="4" cols="50">Text</textarea>
<select>Dropdown selection list<select><option>Option 1</option></select>
<iframe>Inline frame (embed external content)<iframe src="https://example.com"></iframe>
<span>Inline container for text or styling<span class="highlight">Text</span>
<div>Line break (deprecated; use CSS)<br>
<hr>Horizontal line<hr>
<header>Represents a container for introductory content or a set of navigational links<header><h1>Website Header</h1></header>
<nav>Defines navigation links<nav><ul><li><a href="/home">Home</a></li></ul></nav>
<main>Contains the primary content of a document<main><p>Main content goes here.</p></main>
<article>Represents a self-contained composition in a document<article><h2>Article Title</h2><p>Article content...</p></article>
<section>Represents a section within a document<section><h2>Section Title</h2><p>Section content...</p></section>
<aside>Defines content aside from the main content<aside><p>Sidebar content...</p></aside>
<footer>Represents a footer for a section or a page<footer>&copy; 2023 My Website</footer>
<blockquote>Represents a section that is quoted from another source<blockquote><p>Quoted text...</p></blockquote>
<abbr>Defines an abbreviation or acronym<abbr title="World Wide Web">WWW</abbr>
<cite>Defines the title of a work, such as a book or movie<cite>The Great Gatsby</cite>
<code>Represents a fragment of computer code<code>const variable = 42;</code>
<pre>Displays preformatted text<pre> This is preformatted text. </pre>
<mark>Highlights text within a document<p>Search for <mark>keywords</mark> here.</p>
<del>Represents deleted text<p><del>Old text</del> New text</p>
<ins>Represents inserted text<p><ins>New text</ins> Old text</p>
<sup>Defines superscript textE=mc<sup>2</sup>
<sub>Defines subscript textH<sub>2</sub>O
<details>Represents a disclosure widget to show or hide additional content<details><summary>More Info</summary><p>Additional details...</p></details>
<summary>Represents a summary or label for a <details> element<details><summary>More Info</summary><p>Additional details...</p></details>
<time>Represents a specific period in time<p>Event date: <time datetime="2023-10-15">October 15, 2023</time></p>