[html5] microdata and the dl element

Brian Tremblay webmaster at tsmchughs.com
Sun May 20 01:35:17 PDT 2012


On 5/20/12 1:01 AM, Benjamin Hawkes-Lewis wrote:
> On Sun, May 20, 2012 at 5:35 AM, Brian Tremblay wrote:
>> I've marked up a restaurant menu using the <dl> element, with a <dt> for
>> each item, followed by 2 or more <dd> elements, one for price, description,
>> and, where appropriate, additional options.
>>
>> I want to add microdata product markup (http://schema.org/Product) but can't
>> find a way to do it. It seems like I need a wrapper for each menu item
>
> No. You can use @itemref:
>
>   <dl>
>      <dt id=artichokes
>          itemscope
>          itemtype=http://schema.org/Product
>          itemref="artichokes-offers artichokes-description">
>        <span itemprop=name>Artichoke Hearts Au Gratin</span>
>      </dt>
>      <dd id=artichokes-offers
>          itemprop=offers
>          itemscope
>          itemtype=http://schema.org/Offer>
>        <span itemprop=price>$6.50</span>
>      </dd>
>      <dd id=artichokes-description itemprop=description>
>        Diced artichoke hearts baked in a cheddar-parmesan sauce.
>        Served with our Irish soda bread and molasses wheat bread.
>      </dd>
>
>      <dt id=shrimp-cocktail
>          itemscope
>          itemtype=http://schema.org/Product
>          itemref="shrimp-cocktail-offers shrimp-cocktail-description">
>        <span itemprop=name>Peel& Eat Shrimp</span>
>      </dt>
>      <dd id=shrimp-cocktail-offers
>          itemprop=offers
>          itemscope
>          itemtype=http://schema.org/Offer>
>        <span itemprop=price>$7.50</span>
>      </dd>
>      <dd id=shrimp-cocktail-description itemprop=description>
>        A half pound of chilled shrimp with our cocktail sauce.
>      </dd>
>
>    </dl>

Yikes! That's a lot more markup than the original. And I'd have to 
manage unique ids for each menu item, too. It's getting mighty 
complicated.  :-(

>> which I sort of think should be there anyways.
>
> The editor's take was that features should be added to CSS to support
> styling definition names and values as groups.

I'd agree. But my case does not involve styling. It involves trees and 
subtrees and scoping. Without a <dli> there's no clear item parent for 
any <dt> or <dd> element.

-- 
Brian Tremblay



More information about the Help mailing list