What is HTML?
HTML (HyperText Markup Language) is the standard markup language used to create and structure content on web pages[1]. It’s the foundational technology of the World Wide Web and has evolved through many versions since the early days, with HTML5 being the latest standard[5]. HTML defines both the content and structure of websites, and when written properly, it also defines the semantics (meaning) of content in a machine-readable way, which is vital for accessibility and search engine optimization[6].
How HTML Works
HTML uses a system of elements (also called tags) to structure content. These elements tell the browser how to display different parts of a webpage. HTML is often described as the “skeleton” of a webpage that gives every website its shape[8].
The Basic Structure
Every HTML document follows a standard structure:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page Title</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Let me break down each component:
<!DOCTYPE html>: Declares that this is an HTML5 document<html>: The root element that wraps all content<head>: Contains metadata about the document (title, character set, links to stylesheets)<body>: Contains all visible content that appears on the page
HTML Elements in Detail
Headings
HTML provides six levels of headings, from <h1> (most important) to <h6> (least important):
<h1>Main Title</h1>
<h2>Section Heading</h2>
<h3>Subsection Heading</h3>
<h4>Minor Heading</h4>
<h5>Smaller Heading</h5>
<h6>Smallest Heading</h6>
Headings are crucial for document structure and help search engines understand your content hierarchy.
Text Formatting
HTML offers various elements for formatting text:
<p>This is a paragraph with <strong>bold text</strong> and <em>italic text</em>.</p>
<p>You can also use <mark>highlighted text</mark> or <del>deleted text</del>.</p>
<p>For code, use <code>console.log('Hello')</code>.</p>
<blockquote>This is a quotation from another source.</blockquote>
Lists
HTML supports three types of lists:
Unordered Lists (bullet points):
<ul>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ul>
Ordered Lists (numbered):
<ol>
<li>Step one</li>
<li>Step two</li>
<li>Step three</li>
</ol>
Description Lists:
<dl>
<dt>HTML</dt>
<dd>HyperText Markup Language</dd>
<dt>CSS</dt>
<dd>Cascading Style Sheets</dd>
</dl>
Links and Navigation
Links are created using the anchor (<a>) element:
<!-- External link -->
<a href="https://example.com">Visit Example</a>
<!-- Internal link to another page -->
<a href="about.html">About Us</a>
<!-- Link to a section on the same page -->
<a href="#contact">Jump to Contact</a>
<!-- Email link -->
<a href="mailto:[email protected]">Email Us</a>
<!-- Open in new tab -->
<a href="https://example.com" target="_blank">Open in New Tab</a>
Images
Images are embedded using the <img> element. Note that images should always include an alt attribute for accessibility[7]:
<img src="photo.jpg" alt="Description of the image" width="600" height="400">
<!-- Responsive image -->
<img src="image.jpg" alt="Responsive image" style="max-width: 100%; height: auto;">
Tables
Tables organize data in rows and columns:
<table>
<thead>
<tr>
<th>Name</th>
<th>Age</th>
<th>City</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td>30</td>
<td>New York</td>
</tr>
<tr>
<td>Sarah</td>
<td>25</td>
<td>London</td>
</tr>
</tbody>
</table>
Semantic HTML
Semantic HTML uses elements that clearly describe their meaning to both the browser and the developer[6]. This is important for accessibility, SEO, and code maintainability.
Common Semantic Elements
<header>
<nav>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
</ul>
</nav>
</header>
<main>
<article>
<h2>Article Title</h2>
<p>Article content goes here...</p>
</article>
<aside>
<h3>Related Information</h3>
<p>Sidebar content...</p>
</aside>
</main>
<footer>
<p>© 2026 Company Name</p>
</footer>
Key semantic elements:
<header>: Introductory content or navigation<nav>: Navigation links<main>: Main content of the document<article>: Self-contained content<section>: Thematic grouping of content<aside>: Content tangentially related to main content<footer>: Footer information<figure>and<figcaption>: Images with captions
HTML Forms
Forms allow users to input data and interact with websites:
<form action="/submit" method="POST">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="message">Message:</label>
<textarea id="message" name="message" rows="4"></textarea>
<label for="country">Country:</label>
<select id="country" name="country">
<option value="us">United States</option>
<option value="uk">United Kingdom</option>
<option value="ca">Canada</option>
</select>
<input type="checkbox" id="subscribe" name="subscribe">
<label for="subscribe">Subscribe to newsletter</label>
<button type="submit">Submit</button>
</form>
Input Types
HTML5 introduced many new input types:
text,email,password,tel,urlnumber,range,date,time,datetime-localcolor,file,searchcheckbox,radio
HTML Attributes
Attributes provide additional information about elements. Some common attributes include:
Global Attributes (work on any element)
<!-- id: Unique identifier -->
<div id="header">Content</div>
<!-- class: For styling and JavaScript -->
<p class="highlight important">Text</p>
<!-- style: Inline CSS -->
<span style="color: red;">Red text</span>
<!-- title: Tooltip text -->
<abbr title="HyperText Markup Language">HTML</abbr>
<!-- data-*: Custom data attributes -->
<div data-user-id="12345" data-role="admin">User info</div>
Element-Specific Attributes
<!-- Links -->
<a href="page.html" target="_blank" rel="noopener">Link</a>
<!-- Images -->
<img src="photo.jpg" alt="Description" loading="lazy">
<!-- Forms -->
<input type="text" name="username" placeholder="Enter username" required>
HTML Comments
Comments help document your code and are not displayed in the browser:
<!-- This is a single-line comment -->
<!--
This is a multi-line comment
that spans several lines
-->
HTML Entities
Special characters can be displayed using HTML entities:
< <!-- < -->
> <!-- > -->
& <!-- & -->
" <!-- " -->
© <!-- © -->
<!-- non-breaking space -->
Embedding Media
Video
<video width="640" height="360" controls>
<source src="video.mp4" type="video/mp4">
<source src="video.webm" type="video/webm">
Your browser does not support the video tag.
</video>
Audio
<audio controls>
<source src="audio.mp3" type="audio/mpeg">
<source src="audio.ogg" type="audio/ogg">
Your browser does not support the audio element.
</audio>
Iframe (Embedding other content)
<iframe src="https://www.example.com" width="600" height="400" title="Example"></iframe>
Best Practices
- Use semantic HTML: Choose elements that describe their content
- Always include alt text for images: Essential for accessibility
- Validate your HTML: Use tools to check for errors
- Use proper document structure: One
<h1>per page, logical heading hierarchy - Keep code clean and indented: Makes it easier to read and maintain
- Use lowercase for tags and attributes: Standard convention
- Close all tags properly: Even self-closing tags should follow standards
- Include meta tags: For character encoding, viewport, and description
Common Mistakes to Avoid
- Forgetting to close tags
- Nesting elements incorrectly
- Using deprecated tags (like
<font>or<center>) - Not including alt attributes on images
- Using too many
<div>elements instead of semantic alternatives - Inline styling instead of using CSS
- Missing the DOCTYPE declaration
Learning Path
HTML is considered the first and most critical skill for web development[8]. Most tutorials suggest you can learn HTML basics in approximately 4 weeks with consistent effort[4]. The best way to learn is through hands-on practice—building projects like personal portfolios, landing pages, or simple websites[4].
Conclusion
HTML is the foundation of web development. While it may seem simple at first, mastering HTML includes understanding semantic markup, accessibility, forms, and how HTML integrates with CSS and JavaScript to create modern web experiences. The key to becoming proficient is consistent practice and building real projects.