Step 1 β The HTML5 Boilerplate
Every HTML page starts with the same skeleton. In VS Code, type ! and press Tab to generate it automatically. Here it is with detailed explanations:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My First HTML Page</title>
</head>
<body>
<!-- Everything visible goes inside <body> -->
</body>
</html>
Save this as index.html. Open it with Live Server. You will see a blank page with the title "My First HTML Page" in the browser tab. The page is blank because the <body> is empty β time to fill it in.
index.html?
By convention, the main page of a website is named index.html. When someone visits https://example.com/, the web server automatically serves index.html from the root folder. All other pages have descriptive names: about.html, contact.html, products.html.
Step 2 β Headings
HTML has six heading levels: <h1> through <h6>. <h1> is the most important (largest) and <h6> is the least important (smallest). Use headings to create a logical document outline β like chapters in a book.
<body>
<h1>Welcome to My Personal Website</h1>
<h2>About Me</h2>
<h2>My Projects</h2>
<h3>Web Projects</h3>
<h3>Mobile Projects</h3>
<h2>Contact</h2>
</body>
The <h1> represents the single most important heading on the page β its title. Search engines use it as a key signal for what the page is about. Every page should have exactly one <h1>. Use <h2>β<h6> for subheadings, following a logical hierarchy without skipping levels (e.g. don't go from <h2> directly to <h4>).
Step 3 β Paragraphs and Text Formatting
The <p> tag creates a paragraph. Use <strong> for important text (bold), <em> for emphasised text (italic), and <br> for a line break within a paragraph.
<h2>About Me</h2>
<p>
My name is <strong>Jane Smith</strong> and I am a
<em>front-end developer</em> based in London.
I specialise in building fast, accessible web interfaces.
</p>
<p>
I have <strong>5 years of experience</strong> with HTML, CSS,
and JavaScript. I recently started learning
<em>OWL JS</em> for Odoo development.
</p>
<!-- <br> forces a line break within text (use sparingly) -->
<p>
Phone: 07700 900 000<br>
Email: jane@example.com<br>
Location: London, UK
</p>
Step 4 β Links
The <a> (anchor) tag creates a hyperlink. The href attribute specifies the destination URL. Links are what make the web a web.
<!-- External link β opens in same tab -->
<a href="https://ylearner.org">Visit ylearner</a>
<!-- External link β opens in new tab (target="_blank") -->
<!-- rel="noopener noreferrer" is a security best practice -->
<a href="https://github.com" target="_blank" rel="noopener noreferrer">
My GitHub Profile
</a>
<!-- Internal link β navigates to another page in the same site -->
<a href="about.html">About Me</a>
<a href="/contact.html">Contact (absolute path)</a>
<!-- Jump link β scrolls to an element with a matching id -->
<a href="#projects">Jump to Projects Section</a>
<!-- ... later in the page ... -->
<h2 id="projects">My Projects</h2>
<!-- Email link β opens the user's email client -->
<a href="mailto:jane@example.com">Send me an email</a>
<!-- Phone link β tappable on mobile -->
<a href="tel:+447700900000">Call me</a>
Step 5 β Images
The <img> tag embeds an image. It is a void element β no closing tag. The two required attributes are src (the image path or URL) and alt (description for screen readers and if the image fails to load).
<!-- Local image file (in the same folder as index.html) -->
<img src="photo.jpg" alt="Jane Smith smiling at camera" width="300" height="200">
<!-- Image from a URL -->
<img
src="https://picsum.photos/400/300"
alt="A random placeholder image"
width="400"
height="300"
>
<!-- Image inside a link (clicking the image navigates) -->
<a href="https://ylearner.org">
<img src="logo.png" alt="ylearner homepage" width="120">
</a>
<!-- Responsive image (modern approach β CSS handles sizing) -->
<img src="hero.jpg" alt="Hero banner" style="max-width: 100%; height: auto;">
The alt attribute is not optional β it is a legal requirement in many countries for accessibility. Screen readers read alt text aloud to visually impaired users. Search engines also use alt text to understand image content. Write a concise description of what the image shows. For decorative images that add no information, use an empty alt: alt="".
Step 6 β Lists
HTML has two main list types: unordered (<ul>) for bullet points and ordered (<ol>) for numbered items. Both use <li> (list item) elements as children.
<!-- Unordered list β bullet points -->
<h3>My Skills</h3>
<ul>
<li>HTML5</li>
<li>CSS3 and Flexbox</li>
<li>JavaScript (ES6+)</li>
<li>OWL JS and Odoo</li>
</ul>
<!-- Ordered list β numbered -->
<h3>How to Make a Cup of Tea</h3>
<ol>
<li>Boil the kettle</li>
<li>Place a tea bag in a mug</li>
<li>Pour boiling water into the mug</li>
<li>Wait 3 minutes</li>
<li>Remove tea bag and add milk</li>
</ol>
<!-- Nested list β list inside a list item -->
<ul>
<li>Front-End
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>
</li>
<li>Back-End
<ul>
<li>Python</li>
<li>Node.js</li>
</ul>
</li>
</ul>
The Complete First Page
Putting it all together β here is a complete personal about page using everything from this lesson:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Jane Smith β Front-End Developer</title>
</head>
<body>
<h1>Jane Smith β Front-End Developer</h1>
<img src="https://picsum.photos/200/200" alt="Profile photo of Jane Smith" width="200">
<h2>About Me</h2>
<p>
I am a <strong>front-end developer</strong> with 5 years of experience
building fast, accessible web interfaces. Currently learning
<em>OWL JS</em> for Odoo module development.
</p>
<h2>My Skills</h2>
<ul>
<li>HTML5 and Semantic Markup</li>
<li>CSS3 β Flexbox and Grid</li>
<li>JavaScript (ES6+)</li>
<li>React</li>
<li>OWL JS and Odoo</li>
</ul>
<h2>My Projects</h2>
<ol>
<li>Portfolio Website β <a href="https://janesmith.dev" target="_blank" rel="noopener noreferrer">janesmith.dev</a></li>
<li>Odoo Custom Dashboard Module</li>
<li>React Todo App</li>
</ol>
<h2>Contact</h2>
<p>
Email: <a href="mailto:jane@example.com">jane@example.com</a><br>
GitHub: <a href="https://github.com" target="_blank" rel="noopener noreferrer">github.com/janesmith</a>
</p>
</body>
</html>
Save this, open with Live Server, and you have a real β albeit unstyled β about page. The next step is CSS to make it look good.
π Summary
- Every HTML page needs the boilerplate:
<!DOCTYPE html>,<html lang>,<head>with<meta charset>+<meta viewport>+<title>, and<body>. - Headings:
<h1>β<h6>β one<h1>per page, logical hierarchy for subheadings. - Paragraphs:
<p>β use<strong>for important text and<em>for emphasis. - Links:
<a href="url">β usetarget="_blank" rel="noopener noreferrer"for external links. - Images:
<img src="path" alt="description">β always write descriptive alt text. - Lists:
<ul>(bullets) and<ol>(numbered), both containing<li>items. Can be nested.
ποΈ Exercise
Build your own about page using everything in this lesson:
- Start with the HTML5 boilerplate. Set the
<title>to your name. - Add an
<h1>with your name and job title or goal. - Add a section with an
<h2>and two<p>tags describing yourself. Use<strong>and<em>at least once each. - Add an unordered list of at least 5 skills or interests.
- Add an ordered list of your top 3 goals for this year.
- Add at least two links: one to an external site (opens in new tab) and one email link.
- Add an image (use
https://picsum.photos/250/250if you don't have a photo handy). Write a properaltdescription.
π₯ Challenge Exercise
Create a two-page mini-website. Page 1: index.html (your about page from above). Page 2: projects.html β a page listing three fictional or real projects, each with a heading, a short description paragraph, a list of technologies used, and a link. Add navigation links on both pages so users can switch between them. Use relative paths in the <a href> attributes.