替代使用span? [英] Alternative to using span?
问题描述
以下是一个示例。
<span id="s1">Hello</span>
<span id="s2">world</span>
<span id="s3">this</span>
<span id="s4">is</span>
<span id="s5">a</span>
<span id="s6">sentence.</span>
基本上,我有一个脚本将句子的单词分成 span
。有没有更好的方法这样做?也许替代 span
,我不知道?我想到使用类似< u>
的东西,因为它很短,然后删除默认下划线。 < p>
无法工作,因为它是一个块元素。
Basically, I have a script that separates words of a sentence into a span
. Is there a better approach of doing this? Perhaps an alternative to span
that I don't know about? I thought of using something like <u>
because it is short, then removing default underlining. Also <p>
wont work because it is a block element.
推荐答案
由于语义原因,我建议不要使用其他元素,除非有一些真正需要你有更短的元素名称。 < span>
是语义上中性的元素,因此对于这种情况是理想的。
For semantics reasons, I'd advise against using other elements, unless there's some real need for you to have shorter element names. <span>
s are semantically neutral elements, so they'd be ideal for this situation.
这篇关于替代使用span?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!