【问题标题】:How to inherit the background color of textarea from parent element in Internet Explorer?如何从 Internet Explorer 中的父元素继承 textarea 的背景颜色?
【发布时间】:2011-11-05 11:37:08
【问题描述】:

考虑以下示例:(Live demo here)

HTML:

<div id="wrapper">
    <textarea></textarea>
</div>

CSS:

div {
    background-color: #777;
}
textarea {
    background-color: inherit;
}

我希望 textarea 从包装器继承背景颜色。

它在 Firefox 中运行良好。

但是,在 Internet Explorer 7 中,背景颜色是白色。为什么?

我该如何解决这个问题?

【问题讨论】:

    标签: html css internet-explorer textarea background-color


    【解决方案1】:

    IE7 不支持inherit 用于除directionvisibility 之外的任何属性。

    Source.

    您可以将textareabackground-color 改为transparent

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-07-31
      • 2018-03-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多