Mobile app version of vmapp.org
Login or Join
Welton855

: Can I add Microdata properties in deeply nested HTML? Can I define a <span itemprop="example"> within an undefined parent div if that parent div’s parent div is defined? Here is the example:

@Welton855

Posted in: #Html5 #Microdata

Can I define a <span itemprop="example"> within an undefined parent div if that parent div’s parent div is defined?

Here is the example:

<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<p>some text and lorem ipsum</p>
<div class="random">
<span itemprop="price"></span>
</div>
</div>

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Welton855

1 Comments

Sorted by latest first Latest Oldest Best

 

@Rivera981

Yes, you can use the itemprop attribute within an HTML tag even if the immediate enclosing HTML tag brackets, such as <div> and </div>, does not have itemscope and itemtype, as long as some level of enclosing tag brackets does define the item scope and type.

The Microdata attributes can be used in any type of HTML tags, not just <div> and <span>, and many intervening HTML tags and nesting levels may occur.

The itemprop is deemed to apply to the nearest enclosing itemscope.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme