我一直难以决定何时使用b以及何时使用span.
b元素的新语义看起来很模糊.
The b element represents a span of text to which attention is being
drawn for utilitarian purposes without conveying any extra importance
and with no implication of an alternate voice or mood
听起来就像你不能使用strong,em或i时使用的标签.
The b element should be used as a last resort when no other element is
more appropriate.
但是,当短语内容还没有适用的标签时,我们已经获得了span.
The span element doesn’t mean anything on its own… It represents its
children.
有一个示例用途列表
key words in a document abstract,product names in a review,
actionable words in interactive text-driven software,or an article
lede
但是我找不到将它们联系在一起的基本原则,而不是将它们塑造成大胆的. old spec甚至提到了风格:
The b element represents a span of text to be stylistically offset
from the normal prose [emphasis added]
样式是为CSS.我们还建议使用类来显示实际含义
authors can use the class attribute on the b element to identify why
the element is being used
这听起来好像使用太多,不能单独按标签分组.我也可以使用类来解释span的语义.
The span element… can be useful when used together with the global
attributes,e.g. class,lang,or dir.
例子
如果我想要这个:
Your score for CS 101 Final is 42%.
我写吗
Your score for CS 101 Final is 42%.
要么
Your score for CS 101 Final is 42%.
或者对于这个:
Answer: 42
可不可能是
Answer 42
要么
Answer 42
(它只是一个键值对,因此定义列表不适用.)
我不仅仅想知道各个例子的正确标签.我想知道为什么他们是对的.我用什么标准来决定b或span标签?