HTML <!Doctype> tag and Mozilla

I am still in the process of refactoring the HTML for my website. Along this slow and narrow path, I’ve learned some interesting things with the way Mozilla treats the HTML <!Doctype> tag.

I discovered this when Nucleus inserted the following DOCTYPE tag at the top of the HTML file:

   <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
      “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>

and I looked at my site with both Internet Explorer and Mozilla.

Internet Explorer rendered my site beautifully, while Mozilla did not. Puzzled, I compared this to my main index.html page which looks fine within Mozilla. The only differences were the DOCTYPE tag and a few XML attributes in the HTML tag. So I commented out the DOCTYPE tag, and Mozilla rendered my site as nice as Internet Explorer.

Now my curiousity got the best of me, so I did some research and discovered that Mozilla (and others) actually use the DOCTYPE tag to determine how to render the HTML page. In order to handle the non-standard use of HTML, the DOCTYPE tag directs the browser how to render the page.

For more information on this topic see this link.

This entry was posted in Uncategorized. Bookmark the permalink.