html Tag
The <html>
tag indicates the start and end of a web document.
Before declaring the html tag, the webpage declares the DOCTYPE
to inform the browser what version of HTML the page is written in.
The widely used HTML version on the internet today is HTML5
. At the very top of the HTML document, <!DOCTYPE html>
is declared to indicate that this is an HTML5 document.
<!DOCTYPE html>
<html>
<!-- HTML code -->
</html>
Note: Since its first introduction in 1991, HTML has seen several versions. The major versions of HTML are listed below.
HTML (1991)
The original version of HTML was introduced by Tim Berners-Lee, the inventor of the World Wide Web.
HTML 2.0 (1995)
The first standard version of HTML, improved based on feedback from various members of the web community.
HTML 3.2 (1997)
JavaScript was added to control the behavior of webpages.
HTML 4.0 (1997)
Stylesheets (CSS) for styling webpages and improved input forms were added.
HTML5 (2014, current version)
New tags such as <canvas>
, <video>
, and <audio>
were introduced, along with modern features like localStorage
for browser storage.
<html>
Tag
The html tag is the root element of an HTML document and must be placed at the beginning and end of the document.
The <html>
tag contains the <head>
tag, which holds information about the webpage, and the <body>
tag, which contains content to be displayed on the webpage.
Structure Inside the HTML Tag
<!DOCTYPE html>
<html>
<head>
<!-- Include metadata, styles, scripts, etc. here. -->
</head>
<body>
<!-- Insert the actual content to be displayed to the user here. -->
</body>
</html>
The HTML tag can specify the primary language of the webpage using the lang attribute.
For example, a webpage that primarily uses English can be indicated as <html lang="en">
.
<!DOCTYPE html>
<!-- Setting the language to English using the lang attribute -->
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Webpage Title</title>
</head>
<body>
<h1>Section Title</h1>
<p>Paragraph Content</p>
</body>
</html>
Want to learn more?
Join CodeFriends Plus membership or enroll in a course to start your journey.