What is HTML?

Author: Published

In brief: HTML is a markup language that describes the structure and meaning of web page content. It tells the browser which parts are headings, paragraphs, links, images or forms. It is not a programming language: CSS is primarily used to define a page’s appearance, while JavaScript is often used to add behaviour and interaction.

What is HTML used for on a website?

HTML stands for HyperText Markup Language. “Hypertext” means text connected by links to other documents or sections of content. “Markup” refers to tags written in the code that assign a specific role to each part of a document.

When you open a page, the browser reads the HTML and uses it to build the document’s structure. It then displays the content on screen, also taking account of styles and scripts if they have been included. The user usually sees the result of this process, rather than the code itself.

For example, a café’s page might contain the venue’s name as the main heading, a description as a paragraph, the menu as a list and a link for reservations. HTML defines what these elements are, but does not necessarily determine their colour or how much space they take up on screen.

Tags, elements and attributes — how do you read HTML?

A tag is a marker written in angle brackets, such as <p>. Many elements have an opening and a closing tag: in <p>Opening hours</p>, the tags surround the paragraph’s content. The whole thing — the tags together with their content — forms an HTML element.

Not every element surrounds text. The img element, used to embed an image, has no closing tag. Necessary information, such as the file’s address, is supplied through its attributes.

An attribute is additional information placed in an opening tag. The href attribute specifies a link’s destination, src identifies an image’s source, and lang lets you declare the language of a document or part of it. The alt attribute on an image provides alternative text; its content depends on the image’s role, and it is usually left empty for a purely decorative image.

To begin with, it is useful to know a few elements:

Elements can be placed inside other elements, but rules apply. A list contains list items, and a link can be part of a paragraph. Browsers try to repair incorrect markup, so the fact that a page displays correctly does not prove that its HTML is valid.

How does HTML differ from CSS and JavaScript?

These three technologies often work together, but they perform different tasks. CSS, or Cascading Style Sheets, describes a document’s presentation. JavaScript is a programming language that allows you, among other things, to respond to user actions and change a page’s content.

TechnologyMain roleExample in a form
HTMLStructure and meaningAn email address field, label and button
CSSAppearance and layoutColours, spacing and field widths
JavaScriptLogic and behaviourUpdating a message without reloading the page

HTML is not used to write algorithms, loops or custom calculations, which is why it is not classified as a programming language. However, this does not mean that a page without JavaScript must be non-interactive. Links work on their own, and the browser can handle form submission or basic validation of a required field using HTML features.

A simple business profile page can be built entirely in HTML. CSS lets you refine its appearance, while JavaScript is only needed when the intended behaviour goes beyond what the document and browser can do on their own.

Why does an element’s meaning matter more than its appearance?

Semantic HTML means choosing elements according to their meaning. A heading should be a heading in the code, not just text enlarged using styles. Similarly, a link is used to navigate to another page, while a button is usually used to perform an action.

This distinction helps assistive technologies, such as screen readers, present content correctly. Someone using such a tool can, for example, navigate between headings. If the author merely enlarges ordinary paragraphs, that navigation will not reflect the page’s visible layout.

A button created with the appropriate element also has built-in keyboard support. Recreating the same functionality on an arbitrary piece of text requires extra work. Correct HTML is a foundation for accessibility, although it does not, on its own, guarantee that an entire website is accessible.

How can you start learning HTML in practice?

A text editor and a browser are enough for your first attempts. An HTML document usually contains a document type declaration, the root html element, a head section with metadata and a body section with the page’s content. Metadata describes the document: it includes, among other things, the character encoding and the title displayed on the browser tab.

The simplest exercise is a local page with a brief business profile:

  1. Create a text file in your editor and save it as index.html, making sure it does not receive an additional .txt extension.
  2. Build the document’s basic structure, then add a heading, a paragraph and a list of services in the body section.
  3. Open the file in your browser. After each change, save it and refresh the page.
  4. Use the “Inspect” or “Inspect Element” option to see how the browser interprets the structure.

You do not need to publish a local file or buy a domain name for it. Start by organising the content without colours or decorative touches — this makes it easier to check whether you understand the roles of the elements before moving on to styling.

See also: What is 2FA?

Read also

Learn how PHP-FPM handles PHP requests, how it differs from a web server, and how to tune processes for traffic and hosting resources.
Learn how BIND, open-source DNS server software, handles domains, how its two roles differ and when running it yourself makes sense.
Learn what Poland’s REGON register and identification number mean, how they differ from NIP and KRS, and how to check a business’s details.