Skip to main content
Practice

html Tag

The <html> tag signifies the start and end of a web document.

Before declaring the HTML tag, a DOCTYPE declaration is made to inform the browser which version of HTML the page is written in.

The widely used version of HTML on the internet today is HTML 5.


History of HTML

  1. HTML (1991)

    • The original version of HTML introduced by Tim Berners-Lee, the creator of the World Wide Web.
  2. HTML 2.0 (1995)

    • The first standardized version of HTML, defined based on feedback from various members of the web community.
  3. HTML 3.2 (1997)

    • Added tables, scripts (like JavaScript), and several other elements.
  4. HTML 4.0 (1997)

    • Incorporated various features such as stylesheets (CSS), improved forms, and scripting.
  5. HTML5 (2014, current version)

    • The latest version reflecting the needs of modern web applications.
    • Introduced new elements like <canvas>, <video>, <audio>, local storage, geolocation, etc.
    • Enhanced structural and semantic elements (e.g., <header>, <footer>, <article>, <nav>, etc.)

When creating a web page using the current HTML5 version, declare the DOCTYPE at the very top of the HTML code as follows:

DOCTYPE Declaration
<!DOCTYPE html>
<html>
<!-- HTML Code -->
</html>

Adding <!DOCTYPE html> at the top of an HTML document informs the web browser that this web page is written in HTML5.


<html> Tag

The html tag is the root (top-level) element of an HTML document and should be positioned at the start and end of the document.

The <html> tag contains the <head> tag, which holds information about the web page, and the <body> tag, which contains the content displayed on the web page.


Internal Structure of HTML Tags

Basic Structure of an HTML Document
<!DOCTYPE html>
<html>
<head>
<!-- Include the document’s metadata, styles, scripts, etc., here. -->
</head>
<body>
<!-- Include the content actually displayed to the user here. -->
</body>
</html>

The HTML tag has a lang attribute to specify the main language used on the web page.

For example, a web page primarily in English can be indicated with <html lang="en">.


Example of Using the HTML lang Attribute
<!DOCTYPE html>
<!-- Using the lang attribute for English -->
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Webpage Title</title>
</head>
<body>
<h1>Heading</h1>
<p>Paragraph content</p>
</body>
</html>

Want to learn more?

Join CodeFriends Plus membership or enroll in a course to start your journey.