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)