HTML Introduction
If you’re new to web development, the best place to start is with HTML (HyperText Markup Language). It is the backbone of web pages, defining their structure and content. Whether you want to build a simple webpage or a complex web application, HTML is the first language you need to learn.
What is HTML?
HTML stands for HyperText Markup Language. It is not a programming language but a markup language used to create and structure content on the web. HTML consists of elements that define headings, paragraphs, images, links, tables, forms, and more. Browsers read HTML code and render it visually for users.
Why is HTML Important?
- Foundation of Web Development – Every website you visit is built using HTML.
- Compatible with All Browsers – HTML is supported by all web browsers like Chrome, Firefox, Safari, and Edge.
- Works with CSS and JavaScript – HTML structures the content, while CSS styles it and JavaScript adds interactivity.
- SEO Friendly – Proper use of HTML improves search engine rankings.
- Easy to Learn – HTML is beginner-friendly and easy to understand.
Basic Structure of an HTML Document
Every HTML document follows a basic structure:
<!DOCTYPE html>
<html>
<head>
<title>My First Web Page</title>
</head>
<body>
<h1>Welcome to HTML!</h1>
<p>This is my first HTML page.</p>
</body>
</html>
Explanation:
<!DOCTYPE html>
– Declares the document as an HTML5 document.<html>
– The root element that contains the entire HTML page.<head>
– Contains meta-information like the page title.<title>
– Defines the title of the webpage (seen in the browser tab).<body>
– Contains the visible content of the webpage.<h1>
– A heading tag for titles.<p>
– A paragraph tag for text content.
HTML Elements and Tags
HTML uses tags to define elements. Each tag is enclosed within angle brackets (<>
). Most HTML tags have an opening tag (<tag>
) and a closing tag (</tag>
). Some important elements include:
- Headings:
<h1>
to<h6>
- Paragraphs:
<p>
- Links:
<a href="https://example.com">Click Here</a>
- Images:
<img src="image.jpg" alt="Description">
- Lists:
<ul>
(unordered),<ol>
(ordered) - Tables:
<table>
,<tr>
,<td>
- Forms:
<form>
,<input>
,<button>
How to Write Your First HTML Page
- Open a text editor like Notepad, VS Code, or Sublime Text.
- Type the basic HTML structure (as shown above).
- Save the file with a
.html
extension (e.g.,index.html
). - Open the file in a web browser to see the result.
Final Thoughts
HTML is the foundation of web development. Once you understand its structure, you can move on to CSS for styling and JavaScript for interactivity. Keep practicing, and soon, you’ll be building amazing web pages!
Next Steps: Explore how CSS enhances the look of your HTML pages!
Happy coding! 🚀