Skip to content

Introduction to HTML

HTML (HyperText Markup Language) is a markup language used to create the structure of a web page.

It doesn’t “do” anything on its own, but it allows you to describe what an element is: a title, a paragraph, an image, a link, etc.

Warning

It is not a programming language, but a descriptive language.


Every HTML page starts with a standard structure:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>My First HTML Page</title>
</head>
<body>
<h1>Welcome to my site!</h1>
<p>This is my very first paragraph.</p>
</body>
</html>
  • <!DOCTYPE html> → tells the browser we’re using HTML5.
  • <html lang="en"></html> → indicates the page language (English).
  • <head></head> → information invisible to the user (title, encoding, etc.).
  • <body></body> → the visible content of the page.

<h1>Main heading</h1>
<h2>Subheading</h2>

There are 6 levels: <h1> (most important) to <h6>.

<p>This is a paragraph.</p>
<strong>important</strong> → bold <em>emphasis</em> → italic
<img src="image.jpg" alt="description" width="300" />
  • src → path to the image
  • alt → alternative text
  • width → width in pixels
<a href="https://google.com">Visit Google</a>

<ul>
<li>HTML</li>
<li>CSS</li>
</ul>
<ol>
<li>Pizza</li>
<li>Pasta</li>
</ol>

<button>Send</button> <button disabled>Unavailable</button>

Attributes = extra information on a tag
Examples: href, src, alt, disabled, width, etc.


TypeExamplesBehavior
Block<h1>, <p>Takes full width
Inline<strong>, <em>Stays within the text

Some tags don’t contain content, they are self-closing:

<br />
<!-- line break -->
<hr />
<!-- horizontal line -->
<img src="..." />

<!-- This is a comment -->

Useful for keeping track in your code. Browsers ignore them.


<a href="index.html">Home</a> <a href="about.html">About</a>