Getting Started with HTML
Published on January 28, 2026
Written by: Code Arc Studio Editorial Team

HTML, or HyperText Markup Language, is the foundational building block of the web. It provides the structure and meaning for all web content, from simple text to complex applications. Think of it as the skeleton of a website; other technologies like CSS and JavaScript then add the style and interactivity, but HTML is what gives everything its form. Every website you visit is built upon an HTML document rendered by your browser. It's a declarative language, which means you tell the browser what you want to display, not how to display it. You do this using a system of elements, which are represented by tags. These tags enclose different parts of the content to make it appear or act a certain way. Understanding HTML is the essential first step for anyone looking to become a web developer, designer, or digital content creator.
The Basic Document Structure
Every HTML document follows a fundamental structure. This boilerplate code sets up the page and tells the browser how to interpret it. It's the starting point for any webpage you build.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="A brief summary of the page content.">
<title>My First Web Page</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>Hello, World!</h1>
<p>This is a paragraph of text.</p>
<a href="https://example.com">This is a link</a>
</body>
</html>
Here’s a breakdown of this structure:
<!DOCTYPE html>: This declaration defines that the document is an HTML5 document. It's crucial for ensuring the browser renders the page in "standards mode".<html lang="en">: This is the root element of the page. Thelangattribute helps screen readers and search engines understand the page's language.<head>: This section contains meta-information about the document, which isn't displayed directly on the page. It includes the character set (<meta charset="UTF-8">), viewport settings for responsive design, the page title that appears in the browser tab (<title>), and links to external resources like CSS stylesheets (<link>).<body>: This contains all the content that is visible to the user, such as headings (<h1>), paragraphs (<p>), images (<img>), and links (<a>).
Common HTML Tags
| Tag | Description |
|---|---|
<h1> - <h6> |
Heading levels 1 through 6. |
<p> |
Represents a paragraph. |
<a> |
Anchor tag, used to create hyperlinks. |
<img> |
Embeds an image into the document. |
<ul> / <ol> / <li> |
Unordered list, ordered list, and list item. |
<div> |
A generic container for flow content. |
<span> |
A generic inline container. |
<strong> / <em> |
Used for strong importance and emphasis, respectively. |
The Power of Semantic HTML
Beyond basic tags, modern HTML emphasizes 'semantic' markup. This means using tags that describe the meaning and role of the content they enclose. Using semantic tags is crucial for accessibility, SEO, and maintainability. It creates a more meaningful and robust structure for your website.
For example, instead of using generic <div> elements for everything, you should use tags that convey purpose:
<header>: For introductory content or a group of navigational links.<nav>: For a section of the page that contains navigation links.<main>: For the primary, unique content of the page. There should only be one per page.<article>: For self-contained content that could be distributed independently, like a blog post or news story.<section>: For grouping related content. Often contains a heading.<aside>: For content that is tangentially related to the main content, like a sidebar or a callout box.<footer>: For the footer of a page or section, typically containing authorship, copyright, or contact information.<figure>and<figcaption>: To encapsulate media like an image or diagram and its associated caption.
Handling User Input with Forms
HTML forms are a fundamental part of interactive websites, allowing users to submit data to a server. The <form> element is the container for different types of input elements.
<form action="/submit-form" method="post">
<fieldset>
<legend>Personal Information</legend>
<p>
<label for="username">Username:</label>
<input type="text" id="username" name="username" required minlength="4">
</p>
<p>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
</p>
</fieldset>
<fieldset>
<legend>Your Message</legend>
<p>
<label for="message">Message:</label>
<textarea id="message" name="message" rows="4" required></textarea>
</p>
<p>
<label for="topic">Topic:</label>
<select id="topic" name="topic">
<option value="general">General Inquiry</option>
<option value="support">Technical Support</option>
<option value="feedback">Feedback</option>
</select>
</p>
</fieldset>
<button type="submit">Submit</button>
<button type="reset">Reset Form</button>
</form>
Key elements here are <label>, which improves accessibility by linking text to a specific input field, and various <input> types (like text, email, password, checkbox, radio). We've also introduced <fieldset> and <legend> to group related controls, improving both semantics and accessibility. The <select> element provides a dropdown menu, and <textarea> is used for multi-line text input. Client-side validation attributes like required and minlength provide immediate feedback to users without needing JavaScript.
Embedding Multimedia Content
Modern web pages are rich with multimedia. HTML5 provides straightforward tags for embedding images, audio, and video content, making your pages more engaging.
Images
The <img> tag is used to embed images. The alt attribute is crucial for accessibility; it provides a textual description for screen readers and is displayed if the image fails to load.
<figure>
<img
src="image.jpg"
alt="A beautiful sunset over the ocean."
width="600"
height="400"
>
<figcaption>A stunning sunset captured on the coast.</figcaption>
</figure>
Video and Audio
The <video> and <audio> tags work similarly. The controls attribute provides default browser controls for play, pause, and volume. For broader compatibility, you can provide multiple media formats using the <source> element.
<video controls width="640" height="360" poster="thumbnail.jpg">
<source src="movie.mp4" type="video/mp4">
<source src="movie.webm" type="video/webm">
Your browser does not support the video tag.
</video>
<audio controls>
<source src="sound.ogg" type="audio/ogg">
<source src="sound.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
Organizing Data with Tables
Tables are used for displaying tabular data. While they were once used for page layout, this is now an outdated practice that harms accessibility. Modern CSS (like Flexbox and Grid) should be used for layout instead. For data, however, tables are essential.
<table>
<caption>Monthly Sales Report</caption>
<thead>
<tr>
<th scope="col">Month</th>
<th scope="col">Sales</th>
<th scope="col">Expenses</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">January</th>
<td>\$50,000</td>
<td>\$30,000</td>
</tr>
<tr>
<th scope="row">February</th>
<td>\$60,000</td>
<td>\$35,000</td>
</tr>
</tbody>
<tfoot>
<tr>
<th scope="row">Total</th>
<td>\$110,000</td>
<td>\$65,000</td>
</tr>
</tfoot>
</table>
The structure is clear: <thead> for the header, <tbody> for the main data, and <tfoot> for the footer. The scope attribute on headers (<th>) is vital for accessibility, as it tells screen readers whether the header applies to a column (col) or a row (row).
10 Common HTML Errors and Their Fixes
Even seasoned developers make mistakes. Here are 10 common HTML errors and how to fix them, presented in a table for clarity.
| # | Common Error | Why It's a Problem | Solution |
|---|---|---|---|
| 1 | Unclosed Tags | Causes unpredictable rendering issues as the browser tries to guess where the element ends. | Always ensure every opening tag (e.g., <div>, <p>) has a corresponding closing tag (</div>, </p>). |
| 2 | Incorrect Nesting | Violates the HTML specification and can lead to invalid markup and accessibility problems. Example: <p><div>...</p></div>. |
Ensure elements are nested correctly (first in, last out). For example: <div><p>...</p></div>. |
| 3 | Block-level Elements Inside Inline Elements | It's invalid HTML to place a block element (like <div>) inside an inline element (like <span> or <a>). |
Restructure your HTML. Use block elements to contain inline elements, not the other way around. |
| 4 | Missing alt Attribute on Images |
This is a major accessibility failure. Screen readers cannot describe the image to visually impaired users. | Always provide a descriptive alt attribute for every <img> tag. If the image is purely decorative, use an empty alt attribute: alt="". |
| 5 | Using Multiple <h1> Tags |
While technically allowed in HTML5 within different sections, it's a poor practice for SEO and accessibility. There should only be one main heading for the page. | Use a single <h1> for the primary page title, and use <h2> through <h6> to create a logical document outline. |
| 6 | Using <br> for Spacing |
Line breaks are for semantic breaks within text (like a poem), not for creating vertical space between elements. | Use CSS properties like margin or padding to control spacing and layout. |
| 7 | Forgetting <!DOCTYPE html> |
Causes the browser to render the page in "quirks mode," which can lead to inconsistent styling and layout. | Always start your HTML document with the <!DOCTYPE html> declaration. |
| 8 | Using <b> and <i> Instead of <strong> and <em> |
<b> and <i> are purely presentational. <strong> and <em> are semantic, indicating importance and emphasis, which is better for accessibility. |
Prefer <strong> for important text and <em> for emphasized text. |
| 9 | Using Inline Styles | Mixing CSS directly into HTML (e.g., <p style="color: red;">) makes code harder to maintain and overrides external stylesheets. |
Keep styles in a separate CSS file and use classes to apply them. |
| 10 | Using Tables for Layout | An outdated practice from the early web. It's semantically incorrect and terrible for accessibility and responsive design. | Use modern CSS layout techniques like Flexbox or Grid for page layout. Use tables only for displaying tabular data. |