What is an HTML Element?

An HTML element is the actual markup code that tells your browser how to display your marked up text.

    <title>The World Wide Web</title>
    <p>The World Wide Web, abbreviated as WWW and commonly known ...</p>

An HTML element consists of an opening tag and a closing tag.

<h1>The World Wide Web</h1>

When an element contains another element, we can call the containing element a parent, and the contained element a child.

  <h2>Welcome to the World Wide Web</h2>

Attributes can be added to elements to modify or enhance how the element behaves. On some elements (such as for a link) the attribute is required.

<a href="/html/">Learning HTML</a>

Some elements don’t require a closing tag. They’re essentially self-contained and you would never put another element inside of them.

<img src="/images/html-hobbyist-badge.svg" alt="I am an HTML Hobbyist">

In the current version of HTML it’s optional to put a closing slash within the element. Many people still do this to maintain compatibility with older browsers.

<hr />
<img src="/images/html-hobbyist-badge.svg" alt="I am an HTML Hobbyist" />

White space doesn’t matter within an HTML element. Judicious use of indentations and new lines can often make it easier for others to read your code, especially for elements with many attributes.

  alt="I am an HTML Hobbyist"

There are 142 HTML elements. Some of those elements are deprecated, which means they’re no longer supposed to be used, but some browsers will often still support some of them.

A description of the most common HTML elements:

HTML: The Good Parts
Headings <h1> - <h6>
Paragraph <p>
Anchor (Links) <a>
Image <img>
Emphasis (Italics) <em>
Strong (Bold) <strong>
Lists & List Items <ul> or <ol> & <li>
Blockquote <blockquote>
Horizontal Rule <hr>

HTML Semantics

You’ll see people referring to Semantic HTML. By using CSS or JavaScript it’s possible to make an HTML element look or act like some other element. HTML elements usually have some inherent meaning and purpose for how they’re meant to be used, and that you should use HTML elements according to their intended purpose.

For example: your could make a <p> element look and act like a button. For almost all cases it’s just better to use a <button> element.

Active Elements

As of the time of this writing (November 2021) there are 113 HTML elements that are active and, more or less, properly supported in browsers.

Deprecated and Unsupported Elements

As of the time of this writing (November 2021) there are about 31 HTML elements that are deprecated or unsupported. You might see these being used apound the Web and in various tutorials. Use them at your own risk.

Adds a Java applet to the page. Use <object> instead.
Causes the content within to blink off and on.
Creates a scrolling marquee.

For an up to date breakdown of usable HTML elements (as well as File Types, CSS, JavaScript, and other Web technologies) go to Can I Use .