Jump to content

<!DOCTYPE> and DTD question


ajkaramba

Recommended Posts

Hello!

 

I'm a beginner when it comes to XHTML/HTML and therefore I have a question. As far as I know you are supposed to tell the browser what (X)HTML version the document uses in the <!DOCTYPE>-tag and then the browser will "understand" and read the document correctly. But you also provide a link to a DTD that says exactly what elements are allowed etc.

 

My question: Does the browser read the DTD in order to display the document or can it display the document properly by just knowing the actual (X)HTML version stated in <!DOCTYPE>?

 

If the browser doesn't read the DTD, then why is it necessary to include a link to it in the <!DOCTYPE>-tag? :blink:

 

 

Thanks! :D

Link to comment
Share on other sites

Theoretically, DTDs tell mark-up readers what is the proper structure for an XML or SGML document.

 

In practise, the browser just chooses a rendering engine based on whether the DTD is a current standard or not. You should use one of the standard DTDs, there are eight of them which you can find here: http://w3schools.com/tags/tag_doctype.asp

 

If you don't use one of those DTDs, the browser will render your page using an old rendering engine which will cause it to look very different in different browsers.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...