【问题标题】:Why css "text-decoration" inheritance does not work for "inline-block"? [duplicate]为什么css“文本装饰”继承不适用于“内联块”? [复制]
【发布时间】:2015-12-10 12:53:42
【问题描述】:

我想知道 - 为什么“文本 2”没有下划线?

<div style="text-decoration: underline;">
  <div>text 1</div>
  <div style="display: inline-block;">
    <div>text 2</div>
  </div>
  <div style="display: inline;">
    <div>text 3</div>
  </div>
  <div style="display: block;">
    <div>text 4</div>
  </div>
</div>

【问题讨论】:

  • 这是规范,文本修饰在您的情况下不适用完全

标签: html css


【解决方案1】:

您可以在 CSS 规范中找到以下句子:

下划线、上划线和换行仅适用于文本(包括空白、字母间距和字间距):边距、边框和填充将被跳过。用户代理不得在非文本内容上呈现这些文本装饰。例如,图像和内嵌块不得有下划线
http://www.w3.org/TR/CSS2/text.html#lining-striking-props

【讨论】:

    猜你喜欢
    • 2013-05-25
    • 2014-03-11
    • 1970-01-01
    • 2014-02-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多