如何在 HTML5 中实现类似 Acronym 的功能?

发布于 2024-09-26 09:05:21 字数 107 浏览 3 评论 0原文

鉴于 acronym 在 HTML 5 中被删除,如何获得具有类似功能的标准支持?其他所有被删除的标签看起来 CSS 都可以做到这一点,但那个标签似乎被完全删除了......

Given that acronym is removed in HTML 5, how does one get standards support with similar functionality? Every other removed tag looks like CSS can do it, but that one seems to be removed completely...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

心清如水 2024-10-03 09:05:21

重新调整用途用于缩写词和首字母缩略词:

abbr 元素表示缩写词或首字母缩略词,可以选择包含其扩展。

如果您想具体说明您的语义,也许添加 class="acronym" 就可以了。我认为这就是你所能做到的,尽管我应该补充一点, class 没有任何实际的语义价值。

<abbr> has been repurposed for both abbreviations as well as acronyms:

The abbr element represents an abbreviation or acronym, optionally with its expansion.

If you want to be specific with your semantics, perhaps adding class="acronym" would do the trick. I think that's as far as you can go, although I should add that class has no actual semantic value whatsoever.

离旧人 2024-10-03 09:05:21

I thought <abbr> replaced <acronym>?

http://www.html-5.com/tags/abbr-tag/

枯叶蝶 2024-10-03 09:05:21

你能具体说明一下你想让它看起来像什么吗? 的默认样式因浏览器而异。例如,Opera 使用点下划线,而 Chrome 则不会全部设置样式。您是否想模拟特定浏览器的默认样式?

但是,如果您指的是鼠标悬停时出现的工具提示样式消息,则应该能够在 中使用与之前相同的属性:title="your acronym'sDefinition"

Can you clarify exactly what you're trying to make it look like? The default style for <acronym> differs across browsers. Opera uses a dotted underline and Chrome doesn't style it all, for example. Are you trying to emulate a particular browser's default style?

However, if you mean the tooltip-style message that appears on mouse hover, you should be able to use the same attribute in <abbr> as before: title="your acronym's definition".

双手揣兜 2024-10-03 09:05:21

acronym 元素被折叠到 abbr 元素中,因为

  1. 大多数 HTML 作者不知道首字母缩写词和缩写词之间的区别,因此错误地使用了它们和
  2. 用例在这两个元素中,首字母缩写词和缩写词之间的区别无论如何都是无关紧要的。

The acronym element was folded into the abbr element, because

  1. most HTML authors didn't know the difference between an acronym and an abbreviation and thus used them wrongly and
  2. for the use cases of those two elements, the difference between an acronym and an abbreviation are irrelevant anyway.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文