HTML (HyperText Markup Language) is the standard language for creating web pages. It provides the structure of a webpage, defining elements such as headings, paragraphs, links, and images.
<!DOCTYPE html>
<html>
<head>
<title>My First HTML Page</title>
</head>
<body>
<h1>Welcome to HTML</h1>
<p>This is my first paragraph.</p>
</body>
</html>
A simple HTML document consists of the following key components:
<!DOCTYPE html>– Declares the document type.<html>– The root element of an HTML page.<head>– Contains metadata, styles, and the page title.<body>– Contains the visible content of the webpage.
Example:
<!DOCTYPE html>
<html>
<head>
<title>Basic HTML Structure</title>
</head>
<body>
<h1>Understanding HTML Layout</h1>
<p>Each page follows a structured format.</p>
</body>
</html>
HTML provides various elements to format content. Here are a few important ones:
<h1>to<h6>– Headings of different sizes.<p>– Paragraphs for text content.<a>– Links to other pages.<img>– Embeds images.<ul>and<ol>– Lists for organizing content.
Example:
<h2>Example Elements</h2>
<p>This is a paragraph.</p>
<a href="https://www.example.com">Visit Example</a>
HTML supports both ordered and unordered lists:
- Unordered List (
<ul>):- Item 1
- Item 2
- Item 3
- Ordered List (
<ol>):- First item
- Second item
- Third item
Example:
<ul>
<li>Apple</li>
<li>Banana</li>
<li>Cherry</li>
</ul>
Links and images help make web pages interactive:
- Use
<a href="URL">to create hyperlinks. - Use
<img src="URL" alt="Description">to add images.
Example:
<a href="https://www.example.com">Click here</a>
<img src="image.jpg" alt="A sample image">