Keith Power
Keith Power

Reputation: 14141

html span tag within span tag

Is it ok to have a span tag within another span tag? I need to format the digits within a span tag with jquery.

<span id="tprice">The price is: $95</span>

Upvotes: 1

Views: 177

Answers (2)

Chris Pratt
Chris Pratt

Reputation: 239280

Sure, you could even put a span tag within a span tag within a span tag ;).

This is actually pretty common and required in some instances such as when dealing with microformats/microdata.

Upvotes: 3

Rob W
Rob W

Reputation: 348992

Yes, it's OK. There's no rule which forbids, nor discourages this practice.

If that piece of HTML occurs more than once, replace id="tprice" by class="tprice", because the ID must only occur once.

Upvotes: 3

Related Questions