我在为禁用的 input
和 select
元素设置相同的文本颜色时遇到困难。
示例:
input:disabled,
select:disabled,
option:disabled {
color: #b8b8b8;
}
<select disabled style="width: 50pt;">
<option>123</option>
</select><br>
<input disabled value="123" style="width: 45pt;">
检查 this fiddle ...
如何修复才能获得相同的外观,显示相同的颜色?
最佳答案
使用不透明度:1
。
fiddle玩游戏。
input:disabled,
select:disabled,
option:disabled {
color: #b8b8b8;
opacity: 1;
}
<select disabled style="width: 50pt;">
<option>123</option>
</select><br>
<input disabled value="123" style="width: 45pt;">
关于html - 如何设置禁用输入并选择相同颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63764897/