W3C home > Mailing lists > Public > www-html@w3.org > June 2003

RE: block level formatting

From: Asbjørn Ulsberg <asbjorn.ulsberg@nrk.no>
Date: Thu, 26 Jun 2003 10:18:06 +0200
Message-ID: <D186E3C450FED2119AFA00508B08736F06E938E8@MAEXCH05>
To: "'Brian V Bonini'" <b-bonini@cox.net>
Cc: www-html@w3.org

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:15:55 GMT