Every HTML page follows a fixed basic structure. This tells the browser how to interpret the document and where content is placed.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My first page</title>
</head>
<body>
<h1>Hello World</h1>
<p>This is my first HTML page.</p>
</body>
</html>
Explanation:
<!DOCTYPE html>: Defines the HTML5 standard
<html>: Root element of the document
<head>: Metadata (title, character set, styles, scripts)
<body>: Visible content of the webpage
Comments
Comments are ignored by the browser and are only used to explain or structure the code.
<!-- This is a comment -->
<p>This text is visible</p>
Comments
Comments are ignored by the browser and are only used to explain or structure the code.