Sitemap
Stackademic

Stackademic is a learning hub for programmers, devs, coders, and engineers. Our goal is to democratize free coding education for the world.

HTML for Beginners: Document Structure #2

3 min readJul 25, 2024

--

Tags

<!doctype html>: This line defines the document type and version of HTML being used. In this case, it specifies that the document is an HTML5 document.

<html>: The <html> tag is the root element of the HTML document. It encloses all the other elements and has a lang attribute set to en to indicate that the content is in English.

head: The <head> element contains meta information about the document. This includes the title of the page, which is displayed in the browser’s title bar or tab.

<title>: Within the <head> section, the <title> tag specifies the title of the HTML document. This title appears in the browser’s title bar or tab. In this case, the title is My first page.

body: The <body> element contains the content of the HTML document that is visible to the user in the browser.

h1: Within the <body> section, the <h1> tag defines a top-level heading. In this document, the heading is Hello from HTML.

<!doctype html>
<html lang="en">
<head>
<title>My first page</title>
</head>
<body>
<h1>Hello from HTML</h1>
</body>
</html>

What will happen if we omit <!doctype html>?

--

--

Tomas Svojanovsky
Tomas Svojanovsky

Written by Tomas Svojanovsky

I'm a full-stack developer. Programming isn't just my job but also my hobby. I like developing seamless user experiences and working on server-side complexities

Stackademic
Stackademic

Published in Stackademic

Stackademic is a learning hub for programmers, devs, coders, and engineers. Our goal is to democratize free coding education for the world.