About Lesson
What is <!Doctype> Declaration?
In HTML, the DOCTYPE declaration informs the browser about the version of HTML being used and helps the browser to render the page in standards mode, which ensures consistency and compatibility across different browsers. For example, a typical HTML5 DOCTYPE declaration looks like this:
<!DOCTYPE html>
This declaration tells the browser that the document is written in HTML5. In older versions of HTML, DOCTYPE declarations were more complex and specified the Document Type Definition (DTD) to which the document adheres. However, with HTML5, the DOCTYPE declaration is simplified to just <!DOCTYPE html>
, as HTML5 does not require a specific DTD.