在我想要在文本中而不是在<abbr>元素的工具提示中显示全部含义的情况下,是否有一个HTML元素可以用来表示“这就是缩略词的意思”。
例如,我想写下"CSS“的定义,然后我将
<dt>CSS</dt>
<dd>Short for <mark>Cascading Style Sheets</mark>. This is the name of
the language that stylesheets are written in.</dd>在我现在滥用mark的地方,我可以使用哪些元素
PS你可能会考虑回答,根本不用标记,但我想让名字突出斜体字,所以我确实需要一些东西!
发布于 2015-09-22 11:02:19
不幸的是,HTML没有一个表示缩略语扩展形式的专用元素。
来自abbr的这个示例似乎与您的用例非常接近,只是缩写出现在段落中的扩展之后,而不是在包含缩写的dt后面的dd元素中。该示例演示如何使用dfn元素标记展开:
<p>The <dfn id=whatwg>Web Hypertext Application Technology
Working Group</dfn> (<abbr
title="Web Hypertext Application Technology Working Group">WHATWG</abbr>)
is a loose unofficial collaboration of Web browser manufacturers and
interested parties who wish to develop new technologies designed to
allow authors to write and deploy Applications over the World Wide
Web.</p>基于dfn,它说(强调我的):
dfn元素表示术语的定义实例。段落、描述列表组或与dfn元素最近的祖先的区段也必须包含dfn元素给出的术语的定义。
您应该能够以类似的方式标记您的内容:
<dt><abbr title="Cascading Style Sheets">CSS</abbr></dt>
<dd>Short for <dfn>Cascading Style Sheets</dfn>. This is the name of
the language that stylesheets are written in.</dd>但是,我不确定dfn是否适合出现在dd中而不是关联的dt中,即使在同一个dl中也是如此。如果这让你感到困扰的话,下一个最接近的选择就是i。
<dt><abbr title="Cascading Style Sheets">CSS</abbr></dt>
<dd>Short for <i>Cascading Style Sheets</i>. This is the name of
the language that stylesheets are written in.</dd>(我可能会将dfn添加为dt的子级和abbr的父级)
发布于 2015-09-22 10:56:11
要么使用
<i></i> or </em></em>或者使用带数据属性标记的span,例如。
<dt>CSS</dt>
<dd>Short for <span data-acronym>Cascading Style Sheets</mark>. This...</dd>或
<dt>CSS</dt>
<dd>Short for <span data-acronym="CSS">Cascading Style Sheets</mark>. This..</dd>如果这是首字母缩略词,您也可以删除“缩写”,然后只需
<dt>CSS</dt>
<dd>Cascading Style Sheets</dd>然后是另一个条目
<dt>Cascading Style Sheets</dt>
<dd>The language format that web stylesheets are written in.</dd>https://stackoverflow.com/questions/32714887
复制相似问题