RE: block level formatting

Selectors don't work properly in IE5 (does it work in IE6?), so I recommend
using a class and giving all the imgs that class if you want it to work in more
than Mozilla and maybe other browsers like Opera but not IE.

.block { display: block;}

<img class="block">

Another thing to note is that displaying an image as a block you will have
space under it just like text has. Although if block doesn't give you
everything you want, you might want to try display: table-cell.

See: http://www.xs4all.nl/~ppk/css2tests/display.html#table

--- Asbjørn_Ulsberg <asbjorn.ulsberg@nrk.no> wrote:
> 
> 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"
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

Received on Thursday, 26 June 2003 09:50:56 UTC