CodeMIRAI
0 XP

Introduction to HTML

2 min read 2 runnable examples Quiz included

HTML (HyperText Markup Language) describes the structure of a web page: which parts are headings, which are paragraphs, where the images and links go. Every page on the web is built on it.

HTML is one of the three languages every browser understands:

LanguageIts job
HTMLstructure and content: headings, paragraphs, images, links
CSShow it looks (the CSS course)
JavaScripthow it behaves (the JavaScript course)

Your first page

Press Run to see this HTML rendered as a page.

HTML
<!DOCTYPE html>
<html>
  <head>
    <title>My first page</title>
  </head>
  <body>
    <h1>Hello, web!</h1>
    <p>This is my first web page.</p>
  </body>
</html>

The browser reads the tags and draws the page: a big heading, then a paragraph. Press Edit, change the heading text, and run it again.

Tags and elements

HTML is written with tags in angle brackets. Most come in pairs:

  • <p> is the opening tag,
  • </p> is the closing tag (note the slash),
  • everything together, <p>Some text</p>, is an element.
HTML
<h1>A main heading</h1>
<h2>A smaller heading</h2>
<p>A paragraph of text.</p>
<p>Another paragraph, with <strong>bold</strong> and <em>italic</em> words.</p>

HTML describes meaning, not looks

HTML says what something is: a heading, a list, a link. How it looks (colour, size, layout) is the job of CSS, which you will learn in the CSS course. Keeping the two apart makes pages easier to change and easier for search engines and screen readers to understand.

Finished this lesson?Mark it complete to earn +20 XP and move your progress on.