Re: [WSG] img cannot be contained within the body?
James Jeffery wrote: I have never had to use img within the body tag. I was playing about with a test case for a client and happened to put img directly within the body (was for an image on screen with next and prev. links ... a gallery). In HTML 4.x Strict and related specs, the content model of the body element is One or more elements that are either in the group %block or are script elements, and zero or more ins or del elements. !ELEMENT BODY O O (%block;|SCRIPT)+ +(INS|DEL) -- document body -- http://www.w3.org/TR/html4/struct/global.html#h-7.5.1 Since the img element is an inline element, it doesn't meet these requirements. So you have to place it inside an element which is: (a) Allowed by the above rule and (b) Has a content model which allows inline children (so form, which is a block element, wouldn't be suitable, since it has a similar content model to the body element) The content model of the body element is different in Transitional doctypes, and img is allowed to be a child of the body element there. -- David Dorward http://dorward.me.uk/ *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] img cannot be contained within the body?
If you're using XHTML, inline elements (like imgs) need to be contained within a block level element (like a div). On Thu, Nov 6, 2008 at 3:04 PM, James Jeffery [EMAIL PROTECTED] wrote: A very silly question that I cannot believe I am asking. I have never had to use img within the body tag. I was playing about with a test case for a client and happened to put img directly within the body (was for an image on screen with next and prev. links ... a gallery). I validated, and it was saying img needs to be contained. I checked the specs but could not see anything that was stating this. In the real application it wouldn't be directly within the body, because it would be within a page section div anyway, but am just curious. James. *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] *** -- Joseph R. B. Taylor Designer / Developer -- Sites by Joe, LLC Clean, Simple and Elegant Web Design Phone: (609) 335-3076 Fax: (866) 301-8045 Web: http://sitesbyjoe.com Email: [EMAIL PROTECTED] *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] img cannot be contained within the body?
On Thu, Nov 6, 2008 at 3:04 PM, James Jeffery [EMAIL PROTECTED] wrote: A very silly question that I cannot believe I am asking. I have never had to use img within the body tag. I was playing about with a test case for a client and happened to put img directly within the body (was for an image on screen with next and prev. links ... a gallery). I validated, and it was saying img needs to be contained. I checked the specs but could not see anything that was stating this. In the real application it wouldn't be directly within the body, because it would be within a page section div anyway, but am just curious. The specs say that inline elements have to be contained within block level elements. IMG is inline, DIV is block. BODY is neither. -- -- Christian Montoya christianmontoya.net *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***
Re: [WSG] img cannot be contained within the body?
Ah, see. One little assumption threw me off. I know inlines can't contain blocks. I assumed the body element was block level by default. You see, it goes to show, after developing websites for many companies and government agencies over the years you can still be threw off by something silly. Cheers anyway. On Thu, Nov 6, 2008 at 8:18 PM, Christian Montoya [EMAIL PROTECTED] wrote: On Thu, Nov 6, 2008 at 3:04 PM, James Jeffery [EMAIL PROTECTED] wrote: A very silly question that I cannot believe I am asking. I have never had to use img within the body tag. I was playing about with a test case for a client and happened to put img directly within the body (was for an image on screen with next and prev. links ... a gallery). I validated, and it was saying img needs to be contained. I checked the specs but could not see anything that was stating this. In the real application it wouldn't be directly within the body, because it would be within a page section div anyway, but am just curious. The specs say that inline elements have to be contained within block level elements. IMG is inline, DIV is block. BODY is neither. -- -- Christian Montoya christianmontoya.net *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] *** *** List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] ***