Common HTML Elements

Text Formatting

Purpose

Element

Description

Self-Closing

Headings

h1, h2, h3, h4, h5, h6

Six levels of section headings

False

Paragraphs

p

Section of text, like in print

False

Line Break

br

Separates content with a carriage-return

True

Horizontal Rule

hr

A line to separate content

True

Lists

ul, ol, li

Ordered and unordered lists

False

Text emphasis

em

Emphasizes text

False

Text importance

strong

Singles out important text

False

Bold

b

Changes text to bold

False

Italic

i

Changes text to italic

False

Blockquote

blockquote

A quote, with optional citation

False

<strong> vs <bold>: The <strong> element is for content that is of greater importance, while the <b> element is used to draw attention to text without indicating that it's more important.

While <em> is used to change the meaning of a sentence as spoken emphasis does ("I love carrots" vs. "I love carrots"), <strong> is used to give portions of a sentence added importance (e.g., "Warning! This is very dangerous.") Both <strong> and <em> can be nested to increase the relative degree of importance or stress emphasis, respectively. - MDN

Images

Element

Attribute

Description

Self-Closing

Image

img

src

Embeds an image in the document

True

The value of the src attribute can be a path to a local image or an url to a remote image.

alt

An alternative to identify the content of the image for screen readers.

Absolute URLs use the entire URL, including the protocol (http://), to link to a page. These are usually used to link to an external site.

<a href="http://www.google.com">Google</a>

Relative URLs are used to link to a file relative to the file in which you are adding the link element. The value of the href property will consist of two parts: path to file + file name.

<!-- .. indicates one level up -->
<a href="../page1.html">Page 1</a>

<!-- same folder -->
<a href="page2.html">Page 2</a>

<!-- down into subDir folder -->
<a href="subDir/page3.html">Page 3</a>

Title

Element

Attribute

Description

Self-closing

Link

a

href

A link within or between documents

False

The value of the href atrribute can be the url of another page within the site, or a remote site. Or it can be the id of an element within the current page.

target

The value of "_blank" opens the linked to page in a new window.

title

The browser may show this as a tooltip when the user hovers over the link.

Last updated