Computer Study

HTML DOCTYPE

The <!DOCTYPE> tag is an HTML declaration that specifies the version of HTML being used in a web page. It is located at the beginning of an HTML document, before the <html> tag.

The <!DOCTYPE> tag is required for all HTML documents, and its purpose is to tell web browsers what type of document they are rendering, which determines how they should interpret and display the content.

Here’s an example of an HTML document with a <!DOCTYPE> tag for HTML5:

<!DOCTYPE html>
<html>
<head>
<title>My Web Page</title>
</head>
<body>
<h1>Welcome to my web page!</h1>
<p>This is some text.</p>
</body>
</html>

In this example, the <!DOCTYPE html> declaration tells the browser that this is an HTML5 document. This is important because different versions of HTML have different rules and features, and the browser needs to know which version to use to render the document correctly.

There are different versions of the <!DOCTYPE> tag for different versions of HTML, such as HTML 4.01, XHTML 1.0, and HTML5. It’s important to use the correct version of the <!DOCTYPE> tag for the HTML version being used, as this affects how the browser interprets the document.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Check Also
Close
Back to top button