A Doctype Declaration or Document Type Declaration (DTD): This declaration is always made before the <html> tag. We know that HTML documents are written inside the <html> tag. A <!DOCTYPE> declaration must be written before the HTML documents. This declaration is not an HTML tag but an information to the browser about type of document being used by a website. So to specify the version of HTML, the DTD is used in an HTML document.
1. DTD in HTML 4.01:
For example, in the past, this declaration (<!DOCTYPE html PUBLIC "-//CodeAtHome//DTD HTML 4.01 Transitional//EN" "http://www.c815.blogspot.com/html4.dtd">) was made to ensure the browser that the website was using HTML 4.01 as shown below.
2. DTD in HTML 5:
In HTML 5, the <!DOCTYPE> Declaration has much more simplified. It can be written as <!DOCTYPE html> as shown below. Modern web browsers support HTML5. So it is very feasible to use the <!DOCTYPE html> declaration on every website.
No comments
Post a Comment
If you have any doubt, please let me know.