HTML Intro
HTML is the language that describes the content and structure of a web page. A browser reads an HTML file and displays the page on screen.
Marks around text
Tags mark each piece of content. The marks themselves stay hidden on the page.
<p>Welcome to my page.</p>A heading and a paragraph
A heading labels a section. A paragraph holds a block of text.
<h1>My First Page</h1>
<p>This page is a document.</p>Content with different roles
Each tag gives its content a role. The browser uses the role when it displays the page.
<h1>City Park</h1>
<p>The park opens at dawn.</p>
<p>Entry is free.</p>Example
<!DOCTYPE html>
<html>
<head>
<title>My First Page</title>
</head>
<body>
<h1>Welcome</h1>
<p>This is my first web page.</p>
<p>It is written in HTML.</p>
</body>
</html>Key points
- HTML: short for HyperText Markup Language
- Markup: marks added to text to describe its role
- Tag: a mark written with angle brackets, like <p>
- Browser: a program that reads HTML and displays pages
- A web page starts as an HTML document that a browser displays.
In this example, the first line declares the document type. The html element holds the whole page. The head holds the page title. The body holds a heading and two paragraphs. The browser displays the heading first. Then it displays each paragraph in order.
Note
HTML describes content rather than performing calculations.
Try it Yourself
Edit the code, then press Run.
Runs in your browser β the preview under the editor is the real result. Nothing is sent to a server. The code runner panel (right) does the same with more room.
Exercise
What does HTML describe?