HTML (HyperText Markup Language) is the foundation of every website. It provides the basic structure of web pages, allowing browsers to display content such as text, images, links, and multimedia. Whether you're starting a career in web development or simply curious about how websites work, understanding HTML fundamentals is essential.
HTML is a markup language used to create and organize content on the web. It uses tags (enclosed in angle brackets) to define elements such as headings, paragraphs, links, and images. These elements tell the browser how to display content to users.
Every HTML page follows a standard structure:
<!DOCTYPE html>
<html>
<head>
<title>My First Web Page</title>
</head>
<body>
<h1>Welcome to My Website</h1>
<p>This is a simple HTML page.</p>
</body>
</html>
<!DOCTYPE html>: Declares the document type
<html>: Root element of the page
<head>: Contains metadata (title, links, styles)
<body>: Contains visible content
Used to define titles and subtitles:
<h1>Main Heading</h1>
<h2>Subheading</h2>
Used for blocks of text:
<p>This is a paragraph.</p>
Used to navigate between pages:
<a href="https://example.com">Visit Website</a>
Used to display visuals:
<img src="image.jpg" alt="Description of image">
Unordered list:
<ul>
<li>Item One</li>
<li>Item Two</li>
</ul>
Ordered list:
<ol>
<li>First Step</li>
<li>Second Step</li>
</ol>
Attributes provide additional information about elements.
Example:
<a href="https://example.com" target="_blank">Open Link</a>
href: URL of the link
target: Specifies how the link opensSemantic elements improve readability and SEO by clearly describing their meaning.
Examples:
<header> – top section of a page
<nav> – navigation links
<section> – grouped content
<article> – independent content
<footer> – bottom sectionHTML forms collect user data:
<form>
<label>Name:</label>
<input type="text" name="name">
<button type="submit">Submit</button>
</form>
alt text for images