gpt4 book ai didi

html - CSS:textarea 的只读属性影响/更改背景颜色

转载 作者:行者123 更新时间:2023-11-28 06:30:32 25 4
gpt4 key购买 nike

如图所示,我将只读属性应用于文本区域

<textarea readonly>text area content</textarea>

这是textarea的css代码

textarea{
font-size: 15px;
font-family: "Helvetica Neue";
margin: 0 0 0.2rem 0;
color: #000;
width: auto;
word-wrap: break-all;

resize: none;
overflow: hidden;
min-height: 5px;
height: 1px;
max-height: inherit;
background: #c3fdb8;
}

这张图片说明了我目前的挑战 enter image description here假设应用了只读属性,我想保留文本区域的背景颜色。

最佳答案

尝试添加

textarea,textarea[readonly] {

...

}

到CSS。这将确保浏览器的默认只读 CSS 被否决。

关于html - CSS:textarea 的只读属性影响/更改背景颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35000225/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com