How a web page reaches you
What HTML does
Understand HTML as a markup language that gives content structure and meaning rather than deciding how the page should look.
HTML stands for HyperText Markup Language.
It is a markup language. You start with content and mark each part according to what it means.
<h1>My travel notes</h1>
<p>I spent three days in Copenhagen.</p>
The tags tell the browser that the first line is the main heading and the second is a paragraph.
Most elements have an opening tag, some content, and a closing tag:
<p>A paragraph of text</p>
That whole thing is a p element. <p> and </p> are its tags.
Some elements cannot contain content and do not have a closing tag. The image element is one example:
<img src="photo.jpg" alt="A bicycle beside a canal">
HTML is not concerned with how the content looks. You do not use it to say “make this heading blue.” That is CSS’s job.
Instead, HTML answers questions such as:
- Is this text a heading or a paragraph?
- Is this a link?
- Is this a list of related items?
- Is this the main navigation?
Choosing elements for their meaning makes a page easier to use with browsers, search engines, screen readers, and other tools.
A common mistake is picking an element because it looks right in the browser’s default styles. A h3 might look smaller than you want, but if the text is the page title, it still belongs in an h1. Fix the size with CSS later.
Another mistake is using a div for everything. Generic containers are fine when nothing else fits, but a link should stay an a, a list should stay a ul, and a heading should stay a heading.
When you are unsure, ask what the content is, not what you want it to look like. That question usually points you to the right element.
Lesson completed