如何控制<abbr>元素

How to control <abbr> element

在下面的例子中,有没有办法固定或规定 abbr 元素的高度和宽度?谢谢。

<html>

<div class="date"><abbr class='timeago' title=$date></abbr></div>

</html>

dictate 是什么意思?这将是我的解决方案:

abbr
{
  display: inline-block;
  border: 1px dashed gray;
  padding: 5px; /* I guess the best value in this case to play with */
}
<div class="date">This <abbr class='timeago' title=$date>Date</abbr> is important.</div>

您需要将 display:inline-block 添加到您的 attr 元素中才能 'see' 它。

abbr {
  display: inline-block;
  height: 20px;
  width: 20px;
  background: red;
}
<html>
  <div class="date">
      <abbr class='timeago' title=$date></abbr>
  </div>
</html>

编辑它就像设置任何其他元素的样式一样(您只需确保您的元素首先是 'visible' 或 'has content')。