HTML

CHEATSHEET

Elements

reference | element

The <html> HTML element represents the root (top-level element) of an HTML document, so it is also referred to as the root element. All other elements must be descendants of this element.

Example:

<html>
</html>

reference | element

The <body> HTML element represents the content of an HTML document. There can be only one <body> element in a document.

Example:

<body>
  Body content here...
</body>

reference | element

The <h1> to <h6> HTML elements represent six levels of section headings. <h1> is the highest section level and <h6> is the lowest.

Example:

<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>

p
reference | element

The <p> HTML element represents a paragraph. Paragraphs are usually represented in visual media as blocks of text separated from adjacent blocks by blank lines and/or first-line indentation, but HTML paragraphs can be any structural grouping of related content, such as images or form fields.

Example:

<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ullam, praesentium.</p>

br
reference | element

The <br> HTML element produces a line break in text (carriage-return). It is useful for writing a poem or an address, where the division of lines is significant.

Example:

Foo<br>Bar

hr
reference | element

The <hr> HTML element represents a thematic break between paragraph-level elements: for example, a change of scene in a story, or a shift of topic within a section.

Example:

<hr>
img
reference | element

The <img> HTML element embeds an image into the document.

Example:

<img class="fit-picture"
  src="/media/cc0-images/grapefruit-slice-332-332.jpg"
  alt="Grapefruit slice atop a pile of other slices">
map
reference | element

The <map> HTML element is used with <area> elements to define an image map a clickable link area.

Example:

<map>
reference | element

The <area> HTML element defines an area inside an image map that has predefined clickable areas. An image map allows geometric areas on an image to be associated with hypertext links.

Example:

<area>
a
reference | element

The <a> HTML element (or anchor element), with its href attribute, creates a hyperlink to web pages, files, email addresses, locations in the same page, or anything else a URL can address.

Content within each <a> should indicate the link's destination. If the href attribute is present, pressing the enter key while focused on the <a> element will activate it.

Example:

<a href="https://awilum.github.io/">Homepage</a>
reference | element

The <link> HTML element specifies relationships between the current document and an external resource. This element is most commonly used to link to stylesheets, but is also used to establish site icons ( both "favicon" style icons and icons for the home screen and apps on mobile devices ) among other things.

Example:

<link href="/media/examples/link-element-example.css" rel="stylesheet">