Web Fundamentals
What Is HTML and What Is It For?
HTML, short for HyperText Markup Language, is the language used to structure the content of virtually every web page on the internet. If you right-click on any website and choose "View Page Source," what you'll see — underneath any framework or generated markup — is fundamentally HTML: a tree of nested elements describing headings, paragraphs, images, links, forms, and every other piece of content on the page. It is, without exaggeration, the single most foundational technology of the World Wide Web.
Markup, Not Programming
The first thing to understand about HTML is that it is a markup language, not a programming language. This distinction matters. A programming language like JavaScript or Python describes a sequence of logical steps: do this, then do that, repeat this until some condition is met. HTML doesn't describe logic or behavior at all. Instead, it describes structure and meaning: this text is a heading, this text is a paragraph, this image belongs here, this is a link to another page, this input field collects a user's email address.
This is why you cannot "run" HTML the way you run a program — there's no computation happening. Instead, a browser renders HTML: it reads the structure you've described and turns it into the visual layout, text, and interactive elements you see on screen.
Elements, Tags, and Attributes
HTML documents are built from elements. An element usually consists of an opening tag, some content, and a closing tag, like this:
<p>This is a paragraph of text.</p>
Here, <p> and </p> are the opening and closing tags, and the sentence between them is the content of the paragraph element. Some elements, like images or line breaks, don't wrap around any content and are written as a single self-closing tag, such as <img src="photo.jpg" alt="A description of the photo" />.
Elements can also carry attributes, which provide additional information about that specific element. In the image example above, src and alt are attributes: src tells the browser where to find the image file, and alt provides alternative text for screen readers and for cases where the image fails to load. Attributes are one of the main ways HTML elements connect to the outside world — linking to other pages, loading stylesheets and scripts, and identifying elements so that CSS and JavaScript can target them.
A Typical HTML Document
Every HTML page follows a similar basic skeleton:
<!DOCTYPE html>
<html>
<head>
<title>My Page</title>
</head>
<body>
<h1>Welcome</h1>
<p>This is my first web page.</p>
</body>
</html>
The <!DOCTYPE html> declaration tells the browser to render the page according to modern HTML5 rules. The <html> element wraps the entire document. Inside it, the <head> contains metadata that isn't directly displayed — the page title, links to stylesheets, character encoding declarations, and so on — while the <body> contains everything that is actually visible to the user: headings, paragraphs, images, buttons, forms, and every other piece of visible content.
Semantic HTML: Structure That Means Something
Modern HTML encourages what's called semantic markup — using elements that describe the actual meaning of the content, rather than relying purely on generic containers. Instead of wrapping everything in generic <div> elements, HTML5 introduced tags like <header>, <nav>, <main>, <article>, <section>, and <footer>, each of which communicates the role that section of the page plays.
This isn't just a stylistic preference. Semantic HTML has real, practical benefits: it makes pages more accessible to screen readers used by visually impaired users, it helps search engines understand and rank your content more accurately, and it makes the codebase easier for other developers (including future you) to understand at a glance.
Why HTML Has Lasted for More Than Three Decades
HTML was created by Tim Berners-Lee in 1990, and despite the web changing almost beyond recognition since then, HTML is still the foundation every website is built on. That longevity isn't an accident. HTML's design goals — being simple to write, forgiving of small mistakes, and readable by both humans and machines — made it accessible to millions of people who were never professional software engineers. Its backward compatibility means a page written decades ago will, in most cases, still render sensibly in a browser today. And its plain-text, human-readable nature means it works well with version control, search engines, and countless other tools that were never designed specifically for it. We explore this story in much more depth in The History of HTML: Evolution and Versions.
Key takeaways
- HTML is a markup language that describes the structure and meaning of content, not a programming language that describes logic.
- HTML documents are built from nested elements, made of tags and optional attributes.
- Semantic tags like
<header>,<nav>and<article>improve accessibility, SEO, and code readability. - HTML defines structure only — visual styling comes from CSS, and interactivity comes from JavaScript.
- HTML's simplicity and backward compatibility are key reasons it has remained the foundation of the web for over three decades.
Write your first HTML page right now
No installation, no setup — just open the editor, type some HTML, and watch it render live in the preview panel.
Open the Free Online Compiler →