seanruss
12-06-2007, 10:33 PM
Is an img not a block level element? They won't validate when they are in the body and not wrapped in a div.
This WON'T validate:
<!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">
<head><title>test - no div</title></head>
<body>
<img alt="test" src="#" />
</body>
</html>
This WILL:
<!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">
<head><title>test - with div</title></head>
<body>
<div><img alt="test" src="#" /></div>
</body>
</html>
Why do I have to wrap the image in a div to validate? It disgusts me.
This WON'T validate:
<!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">
<head><title>test - no div</title></head>
<body>
<img alt="test" src="#" />
</body>
</html>
This WILL:
<!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">
<head><title>test - with div</title></head>
<body>
<div><img alt="test" src="#" /></div>
</body>
</html>
Why do I have to wrap the image in a div to validate? It disgusts me.