HTML for Beginners: Build Your First Web Page in 30 Minutes
Learn HTML from scratch -- document structure, elements, forms, and semantic tags. Build a complete personal profile page step by step.
HTML is the foundation of every web page. Every website you've ever visited -- Google, YouTube, Wikipedia, your bank -- is built on HTML. It's not a programming language (you won't write loops or functions), it's a markup language that tells the browser what content to display and how to structure it.
If you want to build websites, HTML is where you start. And here's the encouraging part: you can learn enough HTML to build a real web page in about thirty minutes. The language is straightforward, the rules are simple, and your browser already knows how to render it.
Let's build something.
What HTML Actually Is
HTML stands for HyperText Markup Language. You write content inside tags that tell the browser what that content represents:
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
Tags come in pairs: an opening tag and a closing tag . The content goes between them. Some tags are self-closing (they don't wrap content), like and .
The browser reads these tags and renders them as visual elements. You don't need to install anything -- just a text editor and a browser.
Setting Up
You need two things:
- A text editor. VS Code is the standard recommendation (free, from code.visualstudio.com). Notepad or TextEdit technically work but lack helpful features like syntax highlighting.
- A browser. Chrome, Firefox, Safari, Edge -- any modern browser.
index.html. That name is a convention -- web servers look for index.html as the default page.
The Document Structure
Every HTML page has the same skeleton:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My First Web Page</title>
</head>
<body>
<h1>Hello, world!</h1>
<p>This is my first web page.</p>
</body>
</html>
Save this file and open it in your browser (double-click the file, or drag it into the browser window). You'll see a heading and a paragraph.
Let's break down each piece:
-- tells the browser this is an HTML5 document. Always include it on line one.-- the root element.lang="en"tells search engines and screen readers the page is in English.-- metadata about the page. Nothing in here is visible on the page itself.
-- character encoding. UTF-8 supports all languages and special characters.
- -- makes the page responsive on mobile devices.
- -- the text that shows in the browser tab.
-- everything visible on the page goes here.
Headings
HTML has six levels of headings, through :
<h1>Main Page Title</h1>
<h2>Section Heading</h2>
<h3>Subsection Heading</h3>
<h4>Sub-subsection</h4>
<h5>Getting small now</h5>
<h6>Smallest heading</h6>
Use once per page for the main title. Use for major sections, for subsections within those, and so on. This hierarchy matters for accessibility and SEO -- screen readers and search engines use heading levels to understand your page structure.
Don't pick heading levels based on how they look. Use them based on document structure, and use CSS (styling) to control appearance.
Paragraphs and Text
<p>This is a paragraph. Browsers automatically add spacing between paragraphs.</p>
<p>This is another paragraph. Notice how each one gets its own block of space.</p>
For emphasis and importance:
<p>You should <em>definitely</em> learn HTML. It's <strong>absolutely essential</strong> for web development.</p>
-- emphasis (browsers render it as italic)-- strong importance (browsers render it as bold)
<p>Line one.<br />Line two on the next line (same paragraph).</p>
<hr /> <!-- A horizontal line separator -->
Links
Links are what make the web a web. The (anchor) tag creates them:
<a href="https://www.google.com">Go to Google</a>
href-- the URL to link to (hypertext reference)- The text between the tags is what the user clicks on
<a href="https://www.google.com" target="_blank" rel="noopener noreferrer">
Google (new tab)
</a>
rel="noopener noreferrer" is a security best practice when using target="_blank".
Link to another page on your site:
<a href="about.html">About Me</a>
<a href="projects/portfolio.html">My Portfolio</a>
Link to a section on the same page:
<a href="#contact">Jump to Contact</a>
<!-- somewhere below -->
<h2 id="contact">Contact Me</h2>
Images
<img src="photo.jpg" alt="A description of the photo" />
src-- the path to the image filealt-- alternative text. This is shown if the image fails to load and is read by screen readers. Never skip it.
<img src="https://example.com/cat.jpg" alt="A fluffy orange cat" />
Control the size with width and height:
<img src="photo.jpg" alt="Profile photo" width="300" height="200" />
Setting both width and height prevents layout shift as the page loads -- the browser reserves the right amount of space before the image downloads.
Lists
Unordered Lists (Bullet Points)
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>
Ordered Lists (Numbered)
<ol>
<li>Learn HTML</li>
<li>Learn CSS</li>
<li>Learn JavaScript</li>
</ol>
Nested Lists
<ul>
<li>Frontend
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>
</li>
<li>Backend
<ul>
<li>Python</li>
<li>Node.js</li>
</ul>
</li>
</ul>
Tables
Tables are for displaying tabular data (not for page layout -- use CSS for that):
<table>
<thead>
<tr>
<th>Name</th>
<th>Role</th>
<th>Experience</th>
</tr>
</thead>
<tbody>
<tr>
<td>Alice</td>
<td>Developer</td>
<td>5 years</td>
</tr>
<tr>
<td>Bob</td>
<td>Designer</td>
<td>3 years</td>
</tr>
<tr>
<td>Carol</td>
<td>Manager</td>
<td>8 years</td>
</tr>
</tbody>
</table>
-- table header section-- table body section-- table row -- header cell (bold and centered by default) -- regular data cell Divs and Spans
These are generic containers:
<div> <h2>Section Title</h2> <p>Section content goes here.</p> </div>- -- a block-level container (takes up the full width, starts on a new line). Used to group elements for styling or layout.
-- an inline container (flows within text). Used to style a portion of text.<p>The total is <span style="color: green; font-weight: bold;">$29.99</span></p>Before semantic elements existed, developers built entire pages with
tags. Now there are better options.Semantic Elements
Semantic elements describe the meaning of their content, not just its appearance. They help screen readers, search engines, and other developers understand your page structure:
<header> <nav> <a href="/">Home</a> <a href="/about">About</a> <a href="/contact">Contact</a> </nav> </header><main>
<article>
<h1>My Blog Post</h1>
<p>Content goes here...</p>
</article><aside>
<h2>Related Links</h2>
<ul>
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
</ul>
</aside>
</main><footer>
<p>Copyright 2026. All rights reserved.</p>
</footer>-- introductory content, usually containing navigation-- navigation links-- the primary content of the page (only one per page)-- self-contained content that could stand alone-- sidebar or tangentially related content-- a thematic grouping of content-- footer content, copyright, contact info
whenever a more specific element fits. Asays nothing about its content. Asays "this is navigation." That difference matters for accessibility.Forms
Forms collect user input. They're how login pages, search bars, and contact forms work:
<form> <label for="name">Name:</label> <input type="text" id="name" name="name" placeholder="Your name" required /><label for="email">Email:</label>
<input type="email" id="email" name="email" placeholder="you@example.com" required /><label for="message">Message:</label>
<textarea id="message" name="message" rows="4" placeholder="Write something..."></textarea><button type="submit">Send</button>
</form>Key elements:
-- wraps all form elements-- describes an input field. Theforattribute links it to an input'sid. Clicking the label focuses the input.-- a text field. Thetypeattribute changes its behavior:
text-- regular text -email-- validates email format -password-- hides characters -number-- only accepts numbers -checkbox-- a toggle -radio-- pick one from a group-- a multi-line text field-- submits the form
requiredattribute prevents form submission if the field is empty. The browser handles validation automatically.Other input types worth knowing:
<input type="date" /> <input type="color" /> <input type="range" min="0" max="100" /> <input type="file" /><select>
<option value="html">HTML</option>
<option value="css">CSS</option>
<option value="js">JavaScript</option>
</select>Build: A Personal Profile Page
Let's put everything together into a complete page. Create a file called
profile.html:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Alex Chen - Web Developer</title> </head> <body> <header> <nav> <a href="#about">About</a> | <a href="#skills">Skills</a> | <a href="#projects">Projects</a> | <a href="#contact">Contact</a> </nav> </header><main>
<section id="about">
<h1>Alex Chen</h1>
<p><em>Junior Web Developer based in Austin, TX</em></p>
<img src="https://via.placeholder.com/200x200" alt="Photo of Alex Chen" width="200" height="200" />
<p>
Hi there! I'm a self-taught web developer transitioning from a career in graphic design.
I love building clean, accessible websites and I'm currently diving deep into JavaScript
and React.
</p>
</section><hr />
<section id="skills">
<h2>Skills</h2>
<table>
<thead>
<tr>
<th>Technology</th>
<th>Level</th>
<th>Years</th>
</tr>
</thead>
<tbody>
<tr>
<td>HTML</td>
<td>Confident</td>
<td>2</td>
</tr>
<tr>
<td>CSS</td>
<td>Confident</td>
<td>2</td>
</tr>
<tr>
<td>JavaScript</td>
<td>Learning</td>
<td>1</td>
</tr>
<tr>
<td>React</td>
<td>Beginner</td>
<td><1</td>
</tr>
</tbody>
</table>
</section><hr />
<section id="projects">
<h2>Projects</h2><article>
<h3>Personal Portfolio</h3>
<p>A responsive portfolio site built with HTML, CSS, and a touch of JavaScript.</p>
<a href="https://example.com" target="_blank" rel="noopener noreferrer">View Project</a>
</article><article>
<h3>Weather Dashboard</h3>
<p>Fetches real-time weather data from an API and displays forecasts for any city.</p>
<a href="https://example.com" target="_blank" rel="noopener noreferrer">View Project</a>
</article><article>
<h3>Task Tracker</h3>
<p>A simple to-do app with local storage persistence. My first JavaScript project.</p>
<a href="https://example.com" target="_blank" rel="noopener noreferrer">View Project</a>
</article>
</section><hr />
<section id="contact">
<h2>Get in Touch</h2>
<p>Interested in working together? Drop me a message.</p><form>
<div>
<label for="name">Name:</label><br />
<input type="text" id="name" name="name" placeholder="Your name" required />
</div>
<br />
<div>
<label for="email">Email:</label><br />
<input type="email" id="email" name="email" placeholder="you@example.com" required />
</div>
<br />
<div>
<label for="subject">Subject:</label><br />
<select id="subject" name="subject">
<option value="general">General Inquiry</option>
<option value="project">Project Collaboration</option>
<option value="job">Job Opportunity</option>
</select>
</div>
<br />
<div>
<label for="message">Message:</label><br />
<textarea id="message" name="message" rows="5" placeholder="Write your message..." required></textarea>
</div>
<br />
<button type="submit">Send Message</button>
</form>
</section>
</main><footer>
<hr />
<p>
© 2026 Alex Chen |
<a href="https://github.com" target="_blank" rel="noopener noreferrer">GitHub</a> |
<a href="https://linkedin.com" target="_blank" rel="noopener noreferrer">LinkedIn</a>
</p>
</footer>
</body>
</html>This page looks plain right now -- it's unstyled. That's by design. HTML provides the structure and content. CSS (which you should learn next) handles the visual styling. Keeping them separate is a core principle of web development.
What This Page Demonstrates
- Document structure --
DOCTYPE,html,head,body - Headings --
h1for the name,h2for sections,h3for project titles - Paragraphs and emphasis --
p,em - Links -- internal anchor links (
#about) and external links - Images -- with
alttext,width, andheight - Tables -- for the skills grid
- Semantic elements --
header,nav,main,section,article,footer - Forms -- text inputs, email input, select dropdown, textarea, submit button
- Labels -- properly linked with
forandid
Common Mistakes Beginners Make
Skipping thealtattribute on images. Screen readers depend on it. Search engines use it. If the image fails to load, users see it. Always write descriptive alt text. If the image is purely decorative, usealt=""(empty string). Usingfor spacing. If you want more space between elements, use CSS margins and padding.is for actual line breaks within text (like a poem or address), not for layout spacing. Nesting elements incorrectly. Tags must be closed in the reverse order they were opened.is wrong.text
is right. Using headings for styling. Don't usetext
because it looks the right size. Use the heading level that matches the document hierarchy, then style it with CSS. Putting block elements inside inline elements. Ainside ais invalid. Ainside anused to be invalid (HTML5 relaxed this forspecifically, but it's still not great practice). Generally, inline elements go inside block elements, not the other way around.What's Next
HTML alone builds structured content but won't win any design awards. The natural next step is:
- CSS -- styling, colors, layout, responsive design. CSS makes your pages look professional.
- JavaScript -- interactivity. Make buttons do things, validate forms, fetch data from APIs.
- Accessibility -- ARIA attributes, semantic HTML best practices, keyboard navigation
- SEO basics -- meta tags, structured data, page titles, heading hierarchy
For more web development tutorials and guides, check out CodeUp.
Ad 728x90