:强调元素

<em>:强调元素

一些开发者可能会对多个元素看似如何产生相似的视觉结果感到困惑。 是一个常见的示例,因为它们都将文本设为斜体。有什么不同?你应该使用哪个?

¥Some developers may be confused by how multiple elements seemingly produce similar visual results. and are a common example, since they both italicize text. What's the difference? Which should you use?

默认情况下,视觉结果是相同的。但语义不同。 元素代表其内容的强调强调,而 元素代表与普通散文不同的文本,例如外来词,虚构人物的思想,或者当文本引用单词的定义而不代表其含义时 语义意义。(作品的标题,例如书名或电影名,应使用 。)

¥By default, the visual result is the same. However, the semantic meaning is different. The element represents stress emphasis of its contents, while the element represents text that is set off from the normal prose, such as a foreign word, fictional character thoughts, or when the text refers to the definition of a word instead of representing its semantic meaning. (The title of a work, such as the name of a book or movie, should use .)

这意味着使用正确的方法取决于具体情况。两者都不是纯粹的装饰目的,这就是 CSS 样式的目的。

¥This means the right one to use depends on the situation. Neither is for purely decorative purposes, that's what CSS styling is for.

的示例可以是:"就这么做吧!",或:"我们必须对此做点什么"。阅读文本的人或软件会使用语言重音以斜体字强调单词。

¥An example for could be: "Just do it already!", or: "We had to do something about it". A person or software reading the text would pronounce the words in italics with an emphasis, using verbal stress.

的示例可以是:"玛丽女王号昨晚启航"。这里,没有对 "玛丽皇后号" 这个词进行额外的强调或重要性。它只是表明所讨论的对象不是一位名叫玛丽的女王,而是一艘名为玛丽女王的船。 的另一个例子可能是:"the 这个词是一篇文章"。

¥An example for could be: "The Queen Mary sailed last night". Here, there is no added emphasis or importance on the word "Queen Mary". It is merely indicated that the object in question is not a queen named Mary, but a ship named Queen Mary. Another example for could be: "The word the is an article".

¥Examples

在此示例中, 元素用于高亮两个成分列表之间隐式或显式的对比:

¥In this example, the element is used to highlight an implicit or explicit contrast between two ingredient lists:

html

Ice cream is made with milk, sweetener, and cream. Frozen custard, on the

other hand, is made of milk, cream, sweetener, and egg yolks.

结果¥Result

技术总结¥Technical summary

内容类别

流量内容,

措辞内容,可触及的内容。

允许的内容

措辞内容.

标签遗漏

无,开始和结束标记都是强制性的。

允许的父级

任何接受

措辞内容 的元素。

隐式 ARIA 角色

emphasis

允许的 ARIA 角色

任何

DOM 接口

HTMLElement 从 Gecko 1.9.2 (Firefox 4) 开始,Firefox 为该元素实现了 HTMLSpanElement 接口。

规范¥Specifications

If you're able to see this, something went wrong on this page.

浏览器兼容性¥Browser compatibility

If you're able to see this, something went wrong on this page.

也可以看看¥See also

💡 关键要点

一些开发者可能会对多个元素看似如何产生相似的视觉结果感到困惑。 和 是一个常见的示例,因为它们都将文本设为斜体。有什么不同?你应

更多疯狂内容

绝地求生手游肾上腺素介绍 肾上腺素有什么用
现代的目标是使 2022 年 FIFA 世界杯 50% 的官方车辆实现电气化
qq分组怎么编辑 qq分组编辑方法【详细教程】