vs制作html5,vs in HTML5 | 易学教程

I've been having difficulty deciding when to use b and when to use span. The new semantics of the b element seem vague.

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

It sounds like that tag you use when you can't use strong, em, or i.

The b element should be used as a last resort when no other element is

more appropriate.

But we've already got span for when phrasing content doesn't already have an applicable tag.

The span element doesn't mean anything on its own... It represents its

children.

There's a list of example uses

key words in a document abstract, product names in a review,

actionable words in interactive text-driven software, or an article

lede

But I can't find an underlying principle that ties them all together other than styling them bold. The old spec even mentions style:

The b element represents a span of text to be stylistically offset

from the normal prose [emphasis added]

Styling is for CSS. We're also advised to use classes to show what the actual meaning is

authors can use the class attribute on the b element to identify why

the element is being used

Which makes it sound like the uses are too divergent to be grouped by the tag alone. I can also use classes to explain the semantics of span.

The span element... can be useful when used together with the global

attributes, e.g. class, lang, or dir.

Examples

If I want this:

Your score for CS 101 Final is 42%.

do I write

Your score for CS 101 Final is 42%.

or

Your score for CS 101 Final is 42%.

Or for this one:

Answer: 42

would it be

Answer 42

or

Answer 42

(It's only one key-value pair, so definition list would not apply.)

I'm not just interested in knowing the correct tags for the individual examples. I'd like to know why they're correct. What criteria do I use to decide on a b or a span tag?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值