fullstackplus
fullstackplus

Reputation: 1071

Using Microdata's 'itemprop' attribute on non-text elements

I have a following piece of HTML with some Schema.org Microdata added:

<section class="feature" itemprop="description">
    <div class="measure">
      <p>Lorem ipsum etc...</p>
      <p>Lorem ipsum etc...</p>

      <figure class="polaroid product">
        <img src="dry-aged-beef-horizontal.jpg", alt="Dry Aged Beef", itemprop="image" />
        <figcaption>Dry Aged Beef</figcaption>
      </figure>
    </div>
  </section>

Is it all right to use the itemprop attribute on an element that isn't itself a text node (like section above), but contains child elements that are?

Looking at the official Schema.org examples one could become suspicious that only text elements can be tagged with Microdata attributes:

<span itemprop="description">0.7 cubic feet countertop microwave.   Has six preset cooking categories and convenience features like   Add-A-Minute and Child Lock.</span>

Also, my product description consists of more paragraphs than one, so again setting the itemprop tag on a parent element makes all the sense. Is this correct Microdata/Schema.org though?

Upvotes: 1

Views: 497

Answers (1)

unor
unor

Reputation: 96547

Microdata (W3C Note) defines that the property value is, in the general case (which applies in your example):

[…] the element's textContent.

So yes, your usage is fine.

(Of course this means that "Dry Aged Beef" will also be part of the description value.)

Upvotes: 1

Related Questions