CSS如何改变输入框之前输入的文字背景色?
How to change previous typed text background color of input box in CSS?
我是 CSS 的新手,我想了解如何更改使用箭头键选择的文本的背景颜色。我正在使用 Bootstrap 4 来获取样式,我想将其覆盖为我自己的样式。
正常行为:
如果我按下按键,我会看到如下内容:
但是我希望它是另一种颜色(比如透明)。
我刚刚尝试了下面的代码但没有成功。
input[type="text"] {
background: transparent;
border: none;
border-bottom: 1px solid rgb(255, 0, 0);
border-radius:0;
background-color: transparent;
margin:1px;
height: 10px;
max-width: 3% !important;
box-sizing: content-box;
-webkit-box-shadow: none;
box-shadow: none;
}
input[type="text"]:focus {
-webkit-box-shadow: none;
box-shadow: none;
color:sienna !important;
background-color:transparent !important;
}
<input class="form-control col-md-2" required="" type="text" id="0">
要覆盖 Chrome 浏览器应用的默认浏览器样式,请查看这篇文章。我已经用 Bootstrap 测试了这种方法,并且效果很好。
我是 CSS 的新手,我想了解如何更改使用箭头键选择的文本的背景颜色。我正在使用 Bootstrap 4 来获取样式,我想将其覆盖为我自己的样式。
正常行为:
如果我按下按键,我会看到如下内容:
但是我希望它是另一种颜色(比如透明)。
我刚刚尝试了下面的代码但没有成功。
input[type="text"] {
background: transparent;
border: none;
border-bottom: 1px solid rgb(255, 0, 0);
border-radius:0;
background-color: transparent;
margin:1px;
height: 10px;
max-width: 3% !important;
box-sizing: content-box;
-webkit-box-shadow: none;
box-shadow: none;
}
input[type="text"]:focus {
-webkit-box-shadow: none;
box-shadow: none;
color:sienna !important;
background-color:transparent !important;
}
<input class="form-control col-md-2" required="" type="text" id="0">
要覆盖 Chrome 浏览器应用的默认浏览器样式,请查看这篇文章。我已经用 Bootstrap 测试了这种方法,并且效果很好。