What is HTML?
HTML (HyperText Markup Language) is the standard language for creating web pages. It provides the structure of a webpage using a system of elements and tags.
- HyperText: Links that connect different web pages.
- Markup Language: Uses tags to define elements within a document.
Basic Structure of an HTML Document
An HTML document consists of a set of nested elements. Below is a simple example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My First HTML Page</title>
</head>
<body>
<h1>Welcome to HTML</h1>
<p>This is a basic HTML page.</p>
</body>
</html>
Explanation:
<!DOCTYPE html>
: Declares the document type (HTML5).<html lang="en">
: The root element with the language attribute.<head>
: Contains metadata like the page title and character encoding.<title>
: Defines the webpage title shown on the browser tab.<body>
: Contains all the visible content of the page.