A quick reference guide to commonly used HTML elements and CSS selectors/properties.
Element | Description |
---|---|
<html> |
Root element of an HTML document. |
<head> |
Contains metadata and links to external resources. |
<body> |
Contains the visible content of the document. |
Element | Description |
---|---|
<p> |
Defines a paragraph. |
<h1> - <h6> |
Defines headings, from largest (<h1> ) to smallest (<h6> ). |
<a> |
Defines a hyperlink. |
<strong> |
Indicates strong importance. |
<em> |
Indicates emphasized text. |
<mark> |
Highlights text. |
<span> |
Used for grouping inline content. |
<code> |
Denotes a fragment of code. |
Element | Description |
---|---|
<img> |
Embeds an image. |
<video> |
Embeds a video file. |
<audio> |
Embeds an audio file. |
Element | Description |
---|---|
<form> |
Defines a form. |
<input> |
Defines an input field. |
<button> |
Defines a clickable button. |
<label> |
Labels an input field. |
Selector | Description |
---|---|
* |
Universal selector, matches all elements. |
element |
Type selector, matches specific HTML elements (e.g., div ). |
.class |
Class selector, matches elements with a specific class. |
#id |
ID selector, matches an element with a specific ID. |
element, element |
Group selector, matches multiple elements. |
element element |
Descendant selector, matches children of a specific element. |
Property | Description |
---|---|
color |
Sets the text color. |
background-color |
Sets the background color. |
font-size |
Sets the size of the text. |
margin |
Sets the outer spacing around an element. |
padding |
Sets the inner spacing inside an element. |
border |
Sets the border around an element. |