替代HTML粗体标记 [英] Alternative to the HTML Bold tag

查看:80
本文介绍了替代HTML粗体标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,所以我知道在HTML中你可以使用< b> 标签,但不是一个可以在< p> 标签中使用的属性?

Okay, so I know that in HTML you can use the <b> tag, but isn't there a "weight=bold" attribute that I can use in the <p> tag?

还是在CSS或是Javascript?

Or is that in CSS, or Javascript?

推荐答案

请考虑< strong> 标记。这对屏幕阅读器更好,因此更好的可访问性。搜索引擎还使用< strong> 标签来确定重要内容,类似于它们如何使用标头标记< h1> < h2> 等(尽管< b> 也将具有与搜索引擎相似的含义)。如果你想强调文本的重要性,使用< strong> 。如果您不要强调重要性,请使用< b> 标记或使用 font-weight:

Also consider the <strong> tag. It's much better for screen readers and therefore better for accessibility. Search engines also use <strong> tags to determine important content similar to how they use header tags <h1>, <h2>, etc (although <b> will also have similar meaning to search engines). If you want to stress importance of text, use <strong>. If you don't want to stress importance, use the <b> tag or use the font-weight:bold; style on the element or in the CSS.

虽然,如果你对整个段落加粗,最好使用CSS选项。这将减少对屏幕阅读器的影响,并且强调整个段落可能没有意义。但另一方面,我已经看到大胆用来强调整个段落之前有充分的理由。在这种情况下, font-weight:bold; 是您想要使用的,可能在类/样式中。

Although, if you are bolding the entire paragraph, it's probably better to use the CSS option. This will reduce the affect on screen readers and it probably doesn't make sense to have an entire paragraph emphasized. But on the other hand, I've seen bold used to emphasize an entire paragraph before for good reason. In which case, font-weight:bold; is what you want to use, likely in a class/style.

最后,< strong> < b> 重量:粗体; 将工作和完成类似的视觉(可能完全相同),但他们有稍微不同的意义。此外,确保如果粗体是一个标题,请使用标题标签:< h1> < h2> code>等。

In the end, <strong>, <b> or font-weight:bold; will all work and accomplish something similar visually (probably exactly the same), but they have slightly different meanings. Also, make sure that if what you're bolding is a header, use the header tags: <h1>, <h2>, etc.

这篇关于替代HTML粗体标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆