i've searched and could not find any good explanation on here and on the internet many people outline what document types there are but don't explain how to determine which one would work best for your code....
so my question is how do i know which type of document type to declare in my webpage.....i know the difference between XHTML and HTML, i'm not asking that, i'm asking what type of document type such as:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
OR
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
an explanation or links would help.....i appreciate it!
XHTML for validation The other thing is, if you put a premium on validating your code (as well as you can when coding for email), then we recommend the XHTML 1.0 transitional doctype. Naturally, not having a doctype will throw errors and the HTML5 doctype is still evolving.
Explanation: The correct syntax of HTML5 doctype is <! doctype html>, doctype is the very first thing to write in HTML5.
Usage: In previous versions of HTML, the main usage of Doctype was to create a reference to DTD (Document Type Definition) and it was compulsory to refer to DTD but in HTML5, it doesn't need to refer to DTD.
To declare an HTML5 doctype, `<! DOCTYPE html>` is required in the first line of your HTML document. Doctype declaration for HTML5 is not case sensitive and does not require a closing tag.
You can use which you want, but in HTML 5 is recommend to use this:
<!DOCTYPE html>
What works best for you depends on what your situation is.
If you want your HTML page to work correctly on very very old browsers that don't support <!DOCTYPE html>
(and yes, there were such browsers, like Netscape 6) then the strict doctype is really the only possibility.
If you want your HTML page to validate, AND you must, for some reason that you don't want to reveal, use elements like <center>
or <font>
or <u>
, then transitional is the doctype of choice.
However, those are really edge cases, and you should consider forgetting about them. In the majority of cases, <!DOCTYPE html>
will do. Don't look to the past; look to the future.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With