"A guide to HTML for beginners."
By Samir Niroula
27 October 2024HTML, or HyperText Markup Language, structures web content. It defines elements like headings, paragraphs, links, and images. Understanding HTML is crucial for web development.
HTML is a markup language for creating web pages. It uses tags to structure content.
An HTML document includes the <!DOCTYPE html>
declaration and nested tags.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Welcome</title>
</head>
<body>
<h1>Hello, World!</h1>
<p>My first HTML page.</p>
</body>
</html>
<h1>
to <h6>
: Define headings, with <h1>
being the highest level and <h6>
the lowest.<h1>Main Heading</h1>
<h2>Subheading</h2>
<p>
: Defines a paragraph.<p>This is a paragraph.</p>
<a>
: Defines a hyperlink.<a href="https://example.com">Visit Example</a>
<img>
: Embeds an image.<img src="image.jpg" alt="Example Image" />
<div>
: Defines a division or section.<div>This is a section.</div>
<span>
: Defines an inline section.<span>This is an inline section.</span>
<ul>
: Defines an unordered list.<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
<ol>
: Defines an ordered list.<ol>
<li>First item</li>
<li>Second item</li>
</ol>
<li>
: Defines a list item.<li>List item</li>
<table>
: Defines a table.<tr>
: Defines a table row.<td>
: Defines a table cell.<th>
: Defines a table header.<table>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
</table>
<form>
: Defines a form.<input>
: Defines an input field.<button>
: Defines a button.<form>
<label for="name">Name:</label>
<input type="text" id="name" name="name" />
<button type="submit">Submit</button>
</form>
HTML is essential for web development. It provides the structure for web pages and is the foundation for learning CSS and JavaScript.