W3C home > Mailing lists > Public > www-style@w3.org > August 2005

Re: [css21] anonymous block boxes versus block boxes

From: Staffan Mhln <staffan.mahlen@comhem.se>
Date: Mon, 15 Aug 2005 19:00:51 +0200
Message-ID: <4300CA43.9090106@comhem.se>
To: Hkon Wium Lie <howcome@opera.com>
CC: www-style@w3.org

Hkon 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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:40 GMT