...

View Full Version : <img /> semantics



coder_seth
02-27-2004, 09:20 PM
i noticed just now upon trying to validate a simple page displaying a new website concept that it is apparently invalid XHTML to have an <img> as the child of the <body>..

my first thought was that <p><img /></p> doesn't make a lot of sense, so i set the images to display: block and thought i'd be good to go.

so is there a mental angle to this i'm not quite grasping? i just don't understand why it's REQUIRED to be within' a <p> or something else. i mean, i can kind of see why.. but to me "paragraph" is a term of type layout..

liorean
02-28-2004, 05:39 AM
If a paragraph is not proper, why not a div? XHTML tends to not allow inline level elements without a block level container element. Another example is that input is not an allowed child of the form element.

coder_seth
02-28-2004, 08:15 AM
well, is not the <body> considered block level? or neither really? sure, it could be a <div>, but again i say, why not by itself?

me'
02-28-2004, 09:42 AM
<body> can only contain block level elements. <img/> is an inline level element, even if it's told to display block by CSS.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum