Re: Is it possible to wrap an inline element in a div block?

Robert Nicholson wrote:

> If you wanted to center an image for instance. Could you wrap it in a 
> div block and then set the margins on that div block to auto providing 
> you could some how set the width of the block to match the image?

img { display: block; margin-left: auto; margin-right: auto; }

Like that?  No wrapping; the image _is_ a block.  There is nothing that 
says an image is an inline element; it can be given any display type.

Please don't confuse "inline" in the HTML spec (which is just a 
convenient shorthand used by the DTD for a list of element names) with 
"inline" in CSS (which has to do with how the content is rendered).

-Boris

Received on Tuesday, 30 December 2003 00:58:00 UTC