Re: [css21] anonymous block boxes versus block boxes

Håkon Wium Lie wrote:
> Let me offer a use case for keeping elements on the same line. Say you
> are marking up a restaurant menu:
> 
>   <dish><name>fish</name><price>$10</price></dish>
>   <dish><name>meat</name><price>$12</price></dish>
> 
> I'd like to float the price to the right to achieve this formatting
> 
>    Fish               $10
>    Meat               $12
> 
> using this style sheet:
> 
>   dish { display: block }
>   name { display: inline }
>   price { float: right }
> 
> However, Mozilla and others show:
> 
>    Fish
>    Meat               $10
>                       $12
> 
> To achieve my preferred formatting, I have to write:
> 
>   <dish><price>$10</price><name>fish</name></dish>
>   <dish><price>$12</price><name>meat</name></dish>
> 
> Which is not the logical content order.
> 
> (I could have used CSS tables for this, but support is spotty)

But wouldn't a much more reasonable solution in that case have been:

    dish { display: block }
    name { float: left /*; clear: left*/ }
    price { float: right }

Either way, things are rather likely to break when someone decides they 
want a bigger font on that pricetag...

  /Staffan

Received on Monday, 15 August 2005 17:01:04 UTC