<html> – HTML Document Root
The <html> element is the root of an HTML document. It encloses all the content of your web page (excluding the doctype).
Code:
<html lang="en">
<!-- head and body go here -->
</html>
Welcome to the Logique HTML Cheat Sheet - your comprehensive resource for understanding the core building blocks of the web. Whether you're a beginner or an experienced developer, this guide offers detailed explanations, practical code examples, and live demos for the most commonly used HTML tags.
HTML (HyperText Markup Language) is the foundation of every web page, providing the structure and meaning behind content. Explore the sections below to learn about the different tags, how to use them effectively, and best practices to create accessible, well-structured web pages.
The <html> element is the root of an HTML document. It encloses all the content of your web page (excluding the doctype).
<html lang="en">
<!-- head and body go here -->
</html>
Contains metadata about the document such as title, styles, and scripts.
<head>
<meta charset="UTF-8">
<title>Page Title</title>
</head>
Sets the title of the document, which appears in the browser tab.
<title>Your Page Title</title>
Contains all the content of an HTML document like text, images, links, and more.
<body>
<!-- content goes here -->
</body>
Defines a paragraph of text.
<p>This is a sample paragraph.</p>
This is a sample paragraph.
Defines headings with a hierarchical structure from <h1> (most important) to <h6> (least important).
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
Defines a hyperlink to another page or location.
<a href="https://example.com" target="_blank" rel="noopener noreferrer">Visit Example</a>
Defines an inline container for text.
<span style="color: red;">This is a span.</span>
This is a span within a paragraph.
Embeds an image into the page. Always include an alt attribute for accessibility.
<img src="https://placehold.co/400x300?text=Image" alt="Placeholder image" />
Defines a list of items with bullet points.
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
Defines a list of items in a specific sequence.
<ol>
<li>First item</li>
<li>Second item</li>
</ol>
Defines a table with rows and cells.
<table>
<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 |
Defines a form control for user data entry. Configure it with different types (text, email, number, etc.).
<input type="text" placeholder="Enter text here" />
Defines a clickable button for forms or JavaScript actions.
<button type="button">Click Me</button>
Defines an interactive form for user input.
<form>
<input type="text" placeholder="Enter text" />
<button type="submit">Submit</button>
</form>
A generic container used to group and style sections of content.
<div>
This is a division.
</div>
Represents a self-contained piece of content, such as a blog post or news article.
<article>
<h2>Article Title</h2>
<p>Article content goes here...</p>
</article>
Article content goes here...
Whether you're just starting out or looking to sharpen your web development skills, we've got free coding courses to help you grow!