In HTML, a Document Type Declaration (DOCTYPE) is used to specify the version of HTML or XHTML being used in a web document. The DOCTYPE declaration helps the browser to understand and interpret the markup correctly. Here are some commonly used DOCTYPE declarations:
1. HTML5:
html
<!DOCTYPE html>
HTML5 is the latest version of HTML and is widely supported by modern browsers. This DOCTYPE declaration is simple and recommended for most HTML documents.
2. HTML 4.01 Strict:
html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
HTML 4.01 Strict is a version of HTML that focuses on structural markup and avoids deprecated or presentational elements.
3. HTML 4.01 Transitional:
html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
HTML 4.01 Transitional allows the use of deprecated or presentational elements for compatibility with older web pages.
4. XHTML 1.0 Strict:
html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
XHTML 1.0 Strict is an XML-based version of HTML that follows stricter rules and requires well-formed markup.
5. XHTML 1.0 Transitional:
html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
XHTML 1.0 Transitional allows the use of deprecated or presentational elements for compatibility with older web pages.
These are just a few examples of DOCTYPE declarations. The choice of DOCTYPE depends on the version of HTML or XHTML you are using and the requirements of your web document. It is recommended to use the HTML5 DOCTYPE (`<!DOCTYPE html>`) for most modern HTML documents unless you have specific reasons to use an older version.
Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.
We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc