learn2kode.in

HTML Cheat Sheet for Beginners

HTML (HyperText Markup Language) is the foundation of every website. It is used to structure content like text, images, links, and forms.
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>My Website</title>
</head>
<body>
  <h1>Hello World</h1>
</body>
</html>

Output

My Website

Hello World

Common HTML Tags

<h1>Heading 1</h1>
<h6>Heading 6</h6>

<p>This is a paragraph</p>

<br>   <!-- Line break -->
<hr>   <!-- Horizontal line -->
<a href="https://learn2kode.in">Visit Site</a>
Output
<img src="image.jpg" alt="Image description">

Lists

Unordered List
<ul>
  <li>HTML</li>
  <li>CSS</li>
</ul>
Ordered List
<ol>
  <li>Step One</li>
  <li>Step Two</li>
</ol>

Div & Span

<div>This is a block element</div>
<span>This is an inline element</span>
<form>
  <input type="text" placeholder="Name">
  <input type="email" placeholder="Email">
  <input type="password">
  <input type="submit" value="Submit">
</form>

Common Input Types

text | email | password | number | date | checkbox | radio | file

Buttons

<table border="1">
  <tr>
    <th>Name</th>
    <th>Age</th>
  </tr>
  <tr>
    <td>John</td>
    <td>25</td>
  </tr>
</table>
class="box"
id="main"
style="color:red;"
title="Tooltip text"

Semantic HTML (Very Important)

<header>Header</header>
<nav>Navigation</nav>
<main>Main content</main>
<section>Section</section>
<article>Article</article>
<aside>Sidebar</aside>
<footer>Footer</footer>
<video controls>
  <source src="video.mp4">
</video>

<audio controls>
  <source src="audio.mp3">
</audio>
<meta name="description" content="Website description">
<meta name="keywords" content="HTML, CSS, JavaScript">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- This is a comment -->

HTML Best Practices

Next Steps

After HTML, learn: