Your First HTML Page


Code:

<!DOCTYPE html>
<html>
<head>
  <title>My First HTML Page</title>
</head>
<body>
  <h1>Hello, world!</h1>
  <p>This is my first HTML page.</p>
</body>
</html>


Explanation (Line by Line):


<!DOCTYPE html>
  • This line tells the browser that this is an HTML5 document.
  • It is placed at the beginning of every HTML page.
<html> ... </html>
  • This is the main container of the HTML document.
  • All the code is written inside this.
<head> ... </head>
  • This section is for background information (which is not visible to the user on the page).
  • Things like the page title, CSS links, meta info, etc., go here.
<title>My First HTML Page</title>
  • This sets the title that appears in the browser tab.
  • When you open the page, the text you see on the browser tab comes from this.
<body> ... </body>
  • This part holds the visible content of the page.
  • Everything that the user sees in the browser is written here.
<h1>Hello, world!</h1>
  • h1 means Heading 1, which is the biggest heading.
  • This displays "Hello, world!" as a bold and large title.
<p>This is my first HTML page.</p>
  • p stands for paragraph.
  • This represents a normal block of text.