what is Doctype in html ? how to use it

 Q2:what is Doctype in html ? how to use it 

In HTML (Hypertext Markup Language), a DOCTYPE declaration is used to specify which version of HTML (or occasionally XHTML) the document is written in. It stands for Document Type Definition.
The DOCTYPE declaration appears at the very beginning of an HTML document, before the <html> tag. It typically looks like this:

<!Doctype html> //code

This declaration tells the web browser which version of HTML the document is using, so that it can render the document correctly. In the example above, <!DOCTYPE html> indicates that the document is written in HTML5, the latest version of HTML at the time of its introduction.

In earlier versions of HTML, the DOCTYPE declaration was more complex and specific, providing a reference to a formal specification that the document followed. However, with HTML5, the DOCTYPE declaration is simplified to <!DOCTYPE html>, which triggers standards mode in modern web browsers. This mode ensures consistent rendering across different browsers and devices.




1 comment:

Powered by Blogger.