[英]Is it semantically correct to use a <b> element to mark up keywords without highlighting them?
I have a sentence that includes defining a term in another language. 我有一句话,其中包括用另一种语言定义术语。 After reading through the W3C official docs , I used the following markup to convey meaning:
阅读W3C 官方文档后 ,我使用以下标记来传达含义:
<p>The <strong><dfn><i lang="tl">barangay</i></dfn></strong> is the <em>smallest</em> <b class="no-bold">political unit</b> in the <b class="no-bold">Philippines</b>.</p>
with my understanding from the docs that: 根据我对文档的理解:
<strong>
is for strong importance <strong>
非常重要 <dfn>
is for the defining instance <dfn>
用于定义实例 <i>
is for technical terms and/or transliterations <i>
用于技术术语和/或音译 <em>
is for stress emphasis <em>
用于强调压力 <b>
is for highlighting keywords without marking them as important <b>
用于突出显示关键字而不将其标记为重要 What I am not sure of is if I could use the <b>
element just to mark certain words and phrases as "keywords", without bringing attention to them (hence why I added class="no-bold"
to change its appearance using CSS). 我不确定的是,是否可以使用
<b>
元素仅将某些单词和短语标记为“关键字”,而不引起他们的注意(因此,为什么我添加class="no-bold"
来使用CSS)。 Would this be correct usage of the element? 这是元素的正确用法吗?
Styling doesn't change the meaning. 样式不会改变含义。 So if it were appropriate in some context to use
b
with styling (eg, making it bold), it's also appropriate in that context to use b
without any styling. 因此,如果在某些情况下使用带有样式的
b
是适当的(例如,使其变粗),那么在那种情况下使用不带任何样式的b
也适当。
It's conceivable that a user-agent makes use of these b
elements , even if you don't style them or don't do anything else with them. 可以想象 ,即使您不对它们进行样式设置或不对其进行任何其他操作, 用户代理也可以使用这两个
b
元素 。
An actual example: text browsers (or feed readers etc., ie, any UA that doesn't support CSS) might display them in bold by default. 一个实际的例子:文本浏览器(或提要阅读器等,例如,任何不支持CSS的UA)可能默认以粗体显示它们。
class
name for the b
element b
元素的class
名称 However, the class name no-bold
is not ideal, as 但是,类名
no-bold
并不理想,因为
b
element is (not useful for consumers of your markup). b
元素的用途(对标记的使用者没有用)。 This goes for any element, but the spec explicitly mentions it for the b
element, too: 这适用于任何元素,但规范也为
b
元素明确提及:
[…] authors can use the
class
attribute on theb
element to identify why the element is being used, so that if the style of a particular use is to be changed at a later date, the author doesn't have to go through annotating each use.[…]作者可以使用
b
元素上的class
属性来确定使用该元素的原因,这样,如果以后要更改特定用途的样式,那么作者就不必进行注释。每次使用。
A more suitable name might be definition-keyword
or something like that. 更合适的名称可能是
definition-keyword
或类似的名称。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.