HTML is the foundation of every website.
In this series, weβll go from basics β in-depth β best practices with code snippets and mini projects.
Letβs start with Part 1: Getting Started with HTML π
π What is HTML?
HTML (HyperText Markup Language) is the skeleton of a webpage.
It tells the browser what content is on the page (text, images, links, forms).
CSS handles styling, and JavaScript handles interactivity.
Think of HTML as the structure of a house, CSS as the paint & design, and JavaScript as the electricity & movement.
π The Basic Structure
Every HTML document follows a common structure:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hello World</title>
</head>
<body>
<h1>Welcome to HTML!</h1>
<p>This is my first web page.</p>
</body>
</html>
π Letβs break it down:
-
<!DOCTYPE html>
β tells the browser this is an HTML5 document. -
<html>
β wraps everything on the page. -
<head>
β contains metadata (title, description, CSS/JS links). -
<body>
β contains visible content.
π Headings & Paragraphs
Headings define content hierarchy.
<h1>Main Title</h1>
<h2>Subtitle</h2>
<h3>Smaller Heading</h3>
<p>This is a paragraph of text.</p>
Text Formatting:
<p>I love <strong>coding</strong> and <em>coffee</em>.</p>
<p>This is <mark>important</mark> text.</p>
-
<strong>
β bold + importance -
<em>
β italics + emphasis -
<mark>
β highlighted text
π Links:
<a href="https://dev.to" target="_blank">Visit Dev.to</a>
-
href
β destination URL -
target="_blank"
β opens in new tab
π Images:
<img src="cat.jpg" alt="Cute cat smiling">
-
src
β path of image -
alt
β description (important for accessibility & SEO)
π Mini Project: βHello Worldβ Page:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hello World</title>
</head>
<body>
<h1>Hello, World!</h1>
<h2>About Me</h2>
<p>My name is Sharad and I love <strong>coding</strong> + <em>coffee</em>.</p>
<h2>Find Me Online</h2>
<p>
<a href="https://dev.to" target="_blank">Follow me on Dev.to</a>
</p>
<h2>My Cat</h2>
<img src="cat.jpg" alt="A cute cat sitting on the sofa">
</body>
</html>
Top comments (0)