🔗 Lesson 2: Text, Lists & Links

Bold, italics, bullet points, links and pictures

← Back to Web Coding

âœī¸ Making words stand out

Two tags, and the difference between them matters more than it looks:

<p>This is <strong>important</strong>.</p> <p>This is <em>said with emphasis</em>.</p> <p>This is <mark>highlighted</mark>.</p> Try it — this is live

🔊 Why not just <b> and <i>?

They exist, and they only change the look. <strong> and <em> change the meaning — a screen reader actually reads them with more force, so a blind visitor hears what you meant. Same appearance, more care.

📝 Lists

A list is two tags: one for the list itself, one for each item.

Bulleted — order does not matter (ul, for unordered):

<ul> <li>Milk</li> <li>Eggs</li> <li>Dragon food</li> </ul> Try it — this is live

Numbered — order does matter (ol, for ordered):

<ol> <li>Wake up</li> <li>Write some HTML</li> <li>Rule the world</li> </ol> Try it — this is live

You never type the bullets or the numbers. You say this is a list, these are its items, and the browser counts for you. Add an item in the middle of an ol and everything below renumbers itself.

🔗 Links

The tag that built the internet. <a> stands for anchor, and it needs an attribute to say where it goes:

<a href="https://example.com">Visit Example</a>
hrefthe attribute name — "hypertext reference"
"https://â€Ļ"its value, always in quotes
Visit Examplethe words you actually click
<p>Go and read about <a href="https://en.wikipedia.org/wiki/Octopus">octopuses</a>.</p> <p>Or visit <a href="html.html">another page in this folder</a>.</p> Try it — this is live

📎 Two kinds of address

A full address starting https:// goes anywhere on the web. A bare name like about.html means a file sitting next to this one — that is how the pages of one site link to each other.

đŸ–ŧī¸ Pictures

<img> is different in two ways. It has no closing tag — there is nothing to put inside it — and it needs two attributes:

<img src="cat.jpg" alt="A ginger cat asleep on a keyboard">
<img src="img/example-photo.svg" alt="A cartoon cat asleep on a keyboard" width="120"> Try it — this is live

That picture lives in a file next to this page. Change the src to a name that does not exist and the browser shows the alt text instead — which is the first reason to write one.

âš ī¸ alt is not optional

alt describes the picture for anyone who cannot see it — a blind visitor, or anybody whose connection dropped. Writing it is a two-second kindness, and every professional does it.

📏 A line and a break

Two more tags with nothing inside them:

<p>Roses are red<br>Violets are blue</p> <hr> <p>A horizontal rule divides one part from the next.</p> Try it — this is live

â†Šī¸ Enter does nothing

Press Enter twenty times in your HTML and the browser shows one space. It collapses all runs of whitespace. If you want a new line, you have to ask for one — <br> for a line break, or a new <p> for a new paragraph.

✅ What you learned

  • strong and em carry meaning, not just looks.
  • ul + li for bullets; ol + li when the order matters.
  • <a href="â€Ļ"> makes a link. Attributes go in the opening tag, values in quotes.
  • <img src="â€Ļ" alt="â€Ļ"> has no closing tag and always needs alt.
  • The browser ignores your line breaks. Use <br> or a new paragraph.
← Lesson 1: Your First Web Page Lesson 3: Colour & Style →