我一直在尝试将我的 textarea 的颜色永久(不在焦点上)设置为某种颜色。它不起作用......我正在使用 Bootstrap (我不知道它是否与此有关) 但出于某种原因,我无法永久设置我的文本区域的边框颜色。我在我的 CSS 中有这个(我已经尝试过其他组合,我已经看到堆栈溢出)但它不起作用。
textarea{
width: 650px;
min-width:650px;
max-width:650px;
height:400;
min-height:400px;
max-height:400px;
border-color: red; /*NOT WORKING*/
}
宽度和高度有效,所以不用担心。
我在 html 中的文本区域如下所示:
<table class="table">
<tr>
<td><textarea id="task1" class="form-control"></textarea>
</td>
</tr>
是的,它在我有几个文本区域的表格内,但仍然(不知道是否是这个原因,我不这么认为)..
谢谢!
凯文
最佳答案
注意你有一个定义边框的类 .form-control
,将 !important
设置为你的 textarea
或再添加一个类,然后在您的 css 中,并将该类的规则放在 .fom-control
所在的位置之后。
选项 1
CSS
textarea{
width: 650px;
min-width:650px;
max-width:650px;
height:400;
min-height:400px;
max-height:400px;
border:solid 1px orange !important;
}
选项 2
HTML
<table class="table">
<tr>
<td><textarea id="task1" class="form-control orange-border"></textarea>
</td>
</tr>
CSS
.form-control {
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
color: #555;
display: block;
font-size: 14px;
height: 34px;
line-height: 1.42857;
padding: 6px 12px;
transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s;
width: 100%;
}
.orange-border{
border:solid 1px orange;
}
关于javascript - HTML 文本区域永久边框颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31590612/