Is it ok to have a span tag within another span tag? I need to format the digits 开发者_JAVA百科within a span tag with jquery.
<span id="tprice">The price is: $95</span>
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.
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.
精彩评论