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>
<title>My Web Page</title>
<h1>Welcome to my web page!</h1>
<p>This is some text.</p>

Also Read:  div tag in 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.

Previous articleHTML Comments
Next articleHTML Anchor
Namaskaar, Friends main Kapil ka Founder hu. Mere kai English blog bhi hai ,par mera motive yahan par easy language mein Technology se related Gyan ko aap tak pahunchane ka hai .taki aap kuch naya shikh sake. meri koshish hai ki bilkul simple tarike se aap ko nyi updates deta rahu taki aap bhi technology ke is yug mein peeche na rahe aur shikte rahe.Mujhse judne ke liye app mujhe Social Media par follow kar sakte hai.


Leave a Reply