HTML Tags & Attributes Guide

Find HTML elements and attributes, understand what they do, and copy practical examples. Explore modern tags, accessibility features, and legacy markup in one reference.

Select a reference to inspect details
LEARN THE LANGUAGE OF THE WEB

Every website begins with HTML.

Behind every heading, image, navigation menu, form, and button is a language that gives web pages their structure. That language is HTML, short for HyperText Markup Language.

UtilityGlen's HTML Tags & Attributes Guide makes it easier to understand HTML elements, explore their attributes, inspect code examples, and discover what your browser actually renders. Whether you're building your first web page or checking unfamiliar markup, this reference helps connect the code to the result.

Searchable reference Rendered examples Copyable syntax
Explore with confidence

A reference that helps HTML make sense.

Memorizing every HTML element is unnecessary. Understanding when and why to use one is far more valuable. This guide gives you a convenient place to look up markup and understand its purpose.

Explore HTML Elements

Find the tags used to structure headings, paragraphs, tables, forms, media, links, navigation, and entire web pages.

<header> <main> <article>

Understand HTML Attributes

Learn how attributes configure elements, provide information, describe resources, and control supported browser behavior.

id=""   class=""   alt=""

See Code Become a Result

Compare HTML syntax with a visual preview where appropriate, and learn about nonvisual behavior when an element or attribute does not directly display content.

Syntax → Explanation → Result

Find What You Need Faster

Use the searchable index, filters, and organized reference details to move from an unfamiliar HTML name to a practical explanation.

Search · Browse · Learn

Write More Accessible Markup

Recognize why semantic elements, form labels, alternative text, and native browser controls matter for different users and assistive technologies.

Meaning · Structure · Usability

Recognize Legacy HTML

Distinguish modern markup from deprecated or obsolete features, and understand why newer, standards-based alternatives are often preferable.

Modern HTML · Legacy Awareness
HTML FUNDAMENTALS

Anatomy of an HTML Element

Most HTML elements consist of an opening tag, content, and a closing tag. Attributes are placed in the opening tag to provide extra information or configuration.

<a href="/tools">Explore tools</a>

The browser interprets this markup as a hyperlink pointing to the specified path.

1

Opening tag

<a> identifies the element as a hyperlink. The tag name tells the browser what kind of content or control it represents.

2

Attribute and value

href="/tools" specifies the hyperlink destination. Some attributes have text values, while others are boolean attributes.

3

Element content

The words Explore tools are the link's visible text. Elements can also contain other permitted HTML elements.

4

Closing tag

</a> closes the hyperlink element. Some HTML elements, such as <img> and <br>, are void elements and must not have closing tags.

Know the difference

HTML Tags vs. HTML Attributes

They work together, but they do different jobs. Understanding the difference is one of the most important steps in learning HTML.

HTML Elements

Elements define the structure, meaning, or functionality of parts of a document. For example, a heading identifies a heading, a paragraph represents paragraph text, and a button creates an interactive control.

<button>Save changes</button>

Think: What is this part of the page?

HTML Attributes

Attributes supply additional information about an element. They can specify destinations, image alternatives, input types, identifiers, classes, and other supported settings.

<button type="button">Save changes</button>

Think: What extra information does this element need?

Code in action

Four HTML Examples Worth Knowing

These common patterns show how HTML syntax becomes something useful on a real web page.

Real-world markup

01. Headings and Paragraphs

Structure
<h2>Our Services</h2>
<p>Discover what we offer.</p>
BROWSER RESULT
Our Services

Discover what we offer.

Headings establish document structure. Paragraphs contain blocks of prose. Heading levels should reflect the page's logical hierarchy.

02. Buttons

Interaction
<button type="button">
  Save changes
</button>
BROWSER RESULT

The button is a native, keyboard-accessible control. Setting type="button" prevents accidental form submission. A real action still requires appropriate application behavior.

03. Form Labels

Accessibility
<label for="email">Email</label>
<input id="email" type="email">
BROWSER RESULT

Connecting a label to its input makes the form easier to use and helps assistive technologies identify the field. The label's for value must match the input's id.

04. Disclosure Widgets

Native HTML
<details>
  <summary>Read more</summary>
  <p>Extra information.</p>
</details>
BROWSER RESULT — TRY IT
Read more

Extra information.

The <details> and <summary> elements create an expandable disclosure without requiring custom JavaScript.

Write HTML with meaning

Semantic HTML: More Than Just Tags

Semantic HTML uses elements that describe the purpose of their content. A <nav> represents navigation, <main> identifies the main content, and <article> represents a self-contained composition.

Choosing appropriate HTML elements helps browsers, assistive technologies, search systems, and other software interpret a page's organization. Styling alone cannot provide the same meaning.

Useful rule: Choose the element that best describes the content before deciding how it should look.
<header>
<nav>
<main>
<section>
<article>
<aside>
<footer>

An illustrative layout showing how semantic elements can organize a page.

Everyday reference

Essential HTML Tags and What They Do

Here are some of the most useful elements to recognize when reading or writing HTML documents.

Element What it does Typical use
<h1>–<h6>Defines headings at different levels.Page and section headings
<p>Represents a paragraph.Ordinary written content
<a>Creates a hyperlink when given an appropriate destination.Navigation and references
<img>Embeds an image resource.Photographs, illustrations, graphics
<div>Groups flow content without implying special semantics.Layout and styling hooks
<span>Groups phrasing content without special semantics.Inline styling and scripting hooks
<form>Represents a section containing controls for submitting information.Search boxes and contact forms
<input>Creates a form control with behavior determined by its type.Text fields, checkboxes, dates
<table>Represents tabular data.Data comparisons and reports
<video>Embeds video playback.Video content and demonstrations
Attribute essentials

Small Details. Big Differences.

An attribute can change where a link goes, whether an input is required, how an image is described, or which styles apply. These are some of the attributes worth learning first.

HTML attribute cheat sheet
href

Specifies a hyperlink destination for elements such as <a>.

src

Identifies a resource to load for supported elements, such as images or scripts.

alt

Provides an image's text alternative, according to the image's purpose and context.

class

Assigns class tokens commonly used by CSS and JavaScript.

id

Provides an identifier that must be unique within the document.

required

Indicates that supported form controls must have a value for constraint validation.

type

Specifies a type or behavior for elements such as buttons, inputs, and scripts.

disabled

Disables supported form controls, affecting interaction and form submission.

data-*

Provides custom data attributes that scripts can access through the DOM.

Build better habits

Common HTML Mistakes to Avoid

Some markup appears to work in a browser while still being misleading, inaccessible, or invalid. These examples highlight habits that are worth correcting early.

Missing image alternatives

<img src="chart.png">
<img src="chart.png" alt="Sales chart">

Informative images need meaningful alternatives. Decorative images generally use an empty alt="". Complex charts may also need a longer text explanation.

Using the wrong interactive element

<div onclick="save()">Save</div>
<button type="button">Save</button>

Native buttons offer useful keyboard and accessibility behavior. Use links for navigation and buttons for actions, with appropriate event handling.

Choosing headings by appearance alone

Using heading levels only because one looks smaller or bigger.
Choosing heading levels to reflect document structure, then adjusting their visual appearance with CSS.

A clear heading hierarchy makes pages easier to navigate and understand.

Forgetting form labels

<input placeholder="Name">
<label>Name <input></label>

A placeholder does not replace a proper label. Visible, associated labels help make form fields understandable.

Understand the web stack

HTML, CSS, and JavaScript: What Does Each One Do?

Web pages often use all three technologies, but each has a different responsibility.

HTML

Structure & Meaning

Defines the content, document structure, semantic relationships, and native interactive controls.

CSS

Visual Presentation

Controls colors, typography, spacing, responsive layouts, animations, and other presentation details.

JavaScript

Programmed Behavior

Adds dynamic logic, data handling, custom interactions, and changes to page content or behavior.

These roles can overlap in practice: HTML itself includes native interaction features, and CSS also supports interactive states and animations.

Beginner learning path

A Simple Roadmap for Learning HTML

You don't need to learn everything in one day. Start with the foundations, then explore more specialized elements when your projects need them.

01

Learn the document

Understand <!doctype html>, <html>, <head>, <title>, and <body>.

02

Build useful content

Practice headings, paragraphs, lists, links, images, sections, and articles.

03

Create interactive forms

Explore labels, inputs, buttons, selects, validation, and accessible form design.

04

Improve quality

Review document structure, semantic markup, accessibility, responsive design, and validation.

Better web foundations

How HTML Helps Search Engines Understand a Website

HTML is the foundation of how many search engines interpret web pages. Descriptive page titles, well-organized headings, meaningful links, useful body content, and appropriate structured data can help make a document easier for search systems to process and understand.

Semantic HTML is not a shortcut to higher rankings. It supports a clearer page structure and better usability, while search visibility also depends on content quality, discoverability, technical accessibility, relevance, and many other factors.

Logical headings

Organize topics with meaningful heading levels.

Descriptive links

Use link text that communicates the destination or purpose.

Page metadata

Write accurate, distinct titles and helpful descriptions.

Accessible content

Use appropriate semantics and text alternatives.

Questions answered

Frequently Asked Questions About HTML

Clear answers to common HTML questions, from syntax fundamentals to modern web development.

What is HTML used for?

HTML, or HyperText Markup Language, describes the structure and meaning of content in web documents. It defines elements such as headings, links, images, forms, tables, and sections. Browsers interpret HTML to construct a document that can be displayed and interacted with.

What is the difference between an HTML tag and an element?

A tag is markup such as <p> or </p>. An HTML element is the complete document structure represented by the markup, including its content and attributes where applicable. The words are sometimes used casually as synonyms, but they are technically different.

What are HTML attributes?

Attributes appear in an element's opening tag and supply additional information or configuration. For example, href specifies the destination of a hyperlink, while alt supplies a text alternative for an image. Some attributes are global; others apply only to particular elements.

Does every HTML element need a closing tag?

No. Void elements, including <img>, <br>, <hr>, and <input>, do not have closing tags or child content. Some other elements have optional end tags under specific rules, although explicit closing tags are often easier for beginners to understand.

Is HTML case-sensitive?

HTML element and attribute names in HTML syntax are generally ASCII case-insensitive. Lowercase markup is a widely used convention because it improves consistency and readability. Other contexts, such as XML or certain attribute values, can have different case-sensitivity rules.

What is semantic HTML?

Semantic HTML uses elements according to their intended meanings. For example, <nav> identifies navigation, <article> identifies self-contained content, and <button> represents a button. Appropriate semantics make web documents easier to understand and navigate.

Can I create a website using only HTML?

Yes. A basic website can consist entirely of HTML documents and can include links, text, images, tables, forms, and native interactive elements. CSS is commonly added for visual styling, and JavaScript is used when additional programmed behavior is needed.

What is the difference between HTML and HTML5?

HTML5 is a name associated with a major evolution of HTML that introduced or standardized modern document features, including native audio and video elements and various web APIs. Today, HTML is maintained as a continually updated Living Standard rather than a sequence of separately numbered major releases.

Are deprecated HTML tags still supported?

Some older elements continue to render in browsers for compatibility, but that does not mean they should be used in new projects. Obsolete elements may have inconsistent behavior, limited accessibility, or better modern alternatives. Prefer current HTML elements and CSS for visual presentation.

Do HTML tags help with SEO?

Meaningful HTML can help search engines interpret content and structure. Elements such as headings, links, titles, and relevant metadata play important roles, but simply adding more tags does not guarantee better rankings. Accurate, useful content and a technically accessible website remain essential.

How do I check whether my HTML is valid?

Check element nesting, required attributes, duplicate IDs, document structure, and whether elements are used in their intended contexts. An HTML conformance checker can identify many markup errors. Browser developer tools and accessibility testing help identify additional problems that validation alone may miss.

What should beginners learn first in HTML?

Start with the basic document structure, headings, paragraphs, links, images, and lists. Then move to semantic sections, tables for data, forms, common attributes, and accessibility. Building small example pages is a practical way to reinforce what each element does.

Keep experimenting

The best way to understand HTML is to use it.

Explore an unfamiliar element, inspect its syntax, compare the rendered result, and try the example in your own project. Every tag you understand gives you another useful building block for the web.

Back to Guide Content
UtilityGlen

Handy web tools for daily use. Everything runs right in your browser—no sign-ups, no cloud uploads, and your data stays entirely on your device.