【问题标题】:Why do I need the background color set?为什么我需要设置背景颜色?
【发布时间】:2014-05-06 14:01:05
【问题描述】:

我对这件事很困惑。我试图让 div 内的 textarea 在 IE7、IE8 和 IE9 中工作,但我偶然将样式 背景从无更改为颜色。这使它起作用了。

谁能解释一下?

对于混乱的设置,我深表歉意。在我了解背景问题后,会将所有样式转换为 css 文件。

不起作用

<textarea id="chatWindowMessageArea" style="position: absolute; display: block; margin: 0;
                    padding: 0; border: none; float: none; clear: none; left: 35px; top: 302px; width: 315px;
                    max-width: 315px; min-width: 315px; height: 63px; max-height: 63px; min-height: 63px;
                    z-index: 2; background-color: transparent; background: none; font-style: normal;
                    font-weight: normal; font-size: 100%; line-height: normal; text-shadow: none;
                    list-style: none; text-align: left; outline: none; text-indent: 0px; -moz-box-shadow: none;
                    -webkit-box-shadow: none; font-family: arial,sans-serif; font-size: 12px; font-weight: normal;
                    color: black; vertical-align: top; resize: none; overflow: auto;" type="text"
                    name="chat">
                </textarea>

有效!

<textarea id="chatWindowMessageArea" style="position: absolute; display: block; margin: 0;
                    padding: 0; border: none; float: none; clear: none; left: 35px; top: 302px; width: 315px;
                    max-width: 315px; min-width: 315px; height: 63px; max-height: 63px; min-height: 63px;
                    z-index: 2; background-color: transparent; background: #FFFFFF; font-style: normal;
                    font-weight: normal; font-size: 100%; line-height: normal; text-shadow: none;
                    list-style: none; text-align: left; outline: none; text-indent: 0px; -moz-box-shadow: none;
                    -webkit-box-shadow: none; font-family: arial,sans-serif; font-size: 12px; font-weight: normal;
                    color: black; vertical-align: top; resize: none; overflow: auto;" type="text"
                    name="chat">
                </textarea>

【问题讨论】:

  • 出了什么问题?
  • 我无法将标记放置在文本区域内以开始书写。改变背景后,我可以。
  • 你不必为 textarea 使用type="text"
  • 你有很多不必要的东西......这个 JSFiddle 在 IE9 中工作,并删除了所有多余的东西:jsfiddle.net/epVdq/2
  • 问题是你已经指定了背景。您指定了background: none;。正如@Slaks 指出的那样,这使得它nothing,因此textarea 正文/内容实际上不存在。如果您删除了该声明,它将正常工作。

标签: html css internet-explorer-8 internet-explorer-7 internet-explorer-9


【解决方案1】:

background: none 表示您的背景将完全透明。

因此,没有任何东西可以点击;你实际上是在点击隐形框后面的任何东西。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-23
    • 1970-01-01
    • 1970-01-01
    • 2010-11-08
    • 2020-12-06
    相关资源
    最近更新 更多