This reference guide provides quick access to commonly used HTML tags and CSS properties. Use it as a cheat sheet when you're coding and need to remember syntax or look up what a tag or property does.
These are the HTML tags you'll use most frequently when building websites. Each tag serves a specific purpose in structuring content.
<!DOCTYPE html>
<html lang="en">
<!-- All content goes here -->
</html>
<head>
<title>My Page</title>
</head>
<body>
<h1>Hello World</h1>
</body>
<h1>Main Title</h1>
<h2>Section Heading</h2>
<h3>Subsection</h3>
<p>This is a paragraph.</p>
<strong>Important text</strong>
<em>Emphasized text</em>
Line one<br>
Line two
<a href="https://example.com">Click here</a>
<nav>
<a href="/">Home</a>
</nav>
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
<ol>
<li>First</li>
<li>Second</li>
</ol>
<li>List item content</li>
<img src="photo.jpg" alt="Description">
<header>
<h1>Site Title</h1>
</header>
<main>
<!-- Main content -->
</main>
<article>
<h2>Article Title</h2>
<p>Content...</p>
</article>
<section>
<h2>Section Title</h2>
<p>Content...</p>
</section>
<aside>
<p>Related information</p>
</aside>
<footer>
<p>© 2024 My Site</p>
</footer>
These CSS properties control the visual appearance of your HTML elements. Each property modifies a specific aspect of styling.
color: blue;
color: #2563eb;
color: rgb(37, 99, 235);
font-family: Arial, sans-serif;
font-family: Georgia, serif;
font-size: 16px;
font-size: 1.5em;
font-weight: bold;
font-weight: 600;
text-align: center;
text-align: left;
line-height: 1.6;
line-height: 24px;
text-decoration: underline;
text-decoration: none;
background-color: #f0f9ff;
background-color: white;
background-image: url('image.jpg');
opacity: 0.5;
margin: 20px; /* All sides */
margin: 10px 20px; /* Top/bottom, left/right */
margin-top: 15px; /* One side */
padding: 1rem;
padding: 10px 20px;
padding-left: 15px;
border: 2px solid black;
border: 1px dashed #ccc;
border-radius: 8px;
border-radius: 50%; /* Makes circles */
display: block;
display: flex;
width: 100%;
width: 300px;
height: 200px;
height: auto;
max-width: 1200px;
position: relative;
position: absolute;
Attributes provide additional information about HTML elements. They're written inside opening tags.
<div id="header"></div>
<p class="highlight"></p>
<a href="page.html">Link</a>
<img src="photo.jpg" alt="Photo">
<img src="photo.jpg" alt="Sunset over mountains">
<html lang="en"></html>
CSS uses different units to specify sizes, colors, and other values. Understanding these units helps you write effective CSS.
font-size: 16px;
width: 300px;
width: 50%;
height: 100%;
font-size: 1.5em; /* 1.5 times parent font-size */
margin: 2em; /* 2 times current font-size */
font-size: 1.2rem;
color: blue;
background-color: darkgray;
color: #2563eb; /* Blue */
color: #ff0000; /* Red */
color: #000000; /* Black */
color: rgb(255, 0, 0); /* Red */
color: rgb(0, 0, 0); /* Black */