Variable Visions

Articles HTML No-DOCTYPE-tag-will-force-quirks-mode-and-limit-some-CSS-rules-from-applying


tutorials - HTML and Web-Development.

No DOCTYPE tag will force quirks mode and limit some CSS rules from applying

Published Thu. Nov. 08, 2012


You would think all sites would use the standard DOCTYPE tag

While comparing a few pages in a new web site project, I noticed some pages don't use the DOCTYPE tag. It took me a while, but I realized that without the DOCTYPE tag, certain CSS rules will not work.

margin: 0 auto;

any :hover or other pseudo classes

etc.

This may come up if you testing some CSS and your rules don't work...make sure there is a DOCTYPE tag on the html page at the very top:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

 


Tag(s): DOCTYPE