RE: block level formatting

Brian V Bonini wrote:

> #lines { display: block; }
> 
> <div id="lines"><img src="xxx" /><img src="xxx" />
> <img src="xxx" /></div>

<div> is a block element by default, so your CSS does nothing
with the above HTML code. If you want the images inside the
<div> to be block elements, you should write:

  /* display all descendant images of #lines as block
  elements */
  #lines img {
    display: block;
  }

or 

  /* display all images that are directly children of #lines
  as block elements */
  #lines>img {
    display: block;
  }

> in this scenario is display: block saying to display div
> id=lines as a block level element

Yes.

> or to display the contents of div id=lines in this case img
> as block level elements.

No. You have the "id" attribute on the <div>, and then the id
selector (#lines) style this one directly. 

> but is this the correct usage?

If you want to display the images inline, and the <div> as a
block, you don't have to do anything in CSS at all, because
this is their default appearance.

-- 
Asbjørn Ulsberg           -=|=-          X-No-Archive: No
"He's a loathsome offensive brute, yet I can't look away"

Received on Thursday, 26 June 2003 04:18:17 UTC