简体   繁体   中英

Can I use more then one span in a link?

Can I use more then one span in a link?

Like this:

<a href="#" class="sprite">
  <span class="iconSpan"></span>
  <span class="textSpan">text</span>
</a>

<span>是内联元素,因此在另一个html元素中可以没有任何必需的span元素。

SPAN is a GENERIC inline container. It does not matter whether an a is inside span or span is inside a as both are inline elements. Feel free to do whatever seems logically correct to you.

try this

http://jsfiddle.net/nVNqU/

<a href="#" class="sprite iconSpan textSpan">
  text
</a>

是的,您可以根据需要a :)属性就像div ,它覆盖了其中的所有内容:)

Both forms are legal. ( <a> inside <span> or <span> inside <a/> ):

https://stackoverflow.com/a/7427244/2523764

是的,您可以根据需要设置任意多个span

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM