DOCTYPE affect on element rendering in IE
IE interprets HTML/CSS differently if no DOCTYPE is specified.
These examples are tested in IE6. Please view and comment in
the killersites.com forum:
http://killersites.com/mvnforum/mvnforum/viewthread?thread=8765
-
No DOCTYPE specified. The width of the entire element includes the
padding and border and some other mysterious calculations.
View demo -
The document type is HTML 4.01 Transitional
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
View demo -
The document type is HTML 4.01 Strict
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
View demo -
The document type is xhtml 1.0 Transitional
<!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" lang="en" xml:lang="en">
View demo -
The document type is XHTML 1.0 Strict
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
View demo
If so, why not provide a link to it? Just copy the following to your web page:
<a href='http://upwithabang.com/articles/css-doctype-width.html'>
DOCTYPE & IE
</a>
Share this:
