我花了一个小时试图将我的css应用于表单内文本类型的引导输入。这是我的代码:
<form>
<div class="form-group">
<input type="text" name="username" value="" id="username" class="form-control" />
</div>
</form>
input [type=text] {
background-color: red !important;
}
奇怪的是,如果我删除[type=text]
部分,那么一切都很好。
JSFiddle
您必须删除input
和[type=text]
之间的空格:
input[type=text] {
background-color: red !important;
}
<input type="text"/>
<input type="password"/>
您的背景拼写错误并删除空格。
input [type=text] {
barckground-color: red !important;
}
因此,请确保键入正确。
input[type=text] {
background-color: red !important;
}
嗨,
试试这个,希望我能帮助你:
<div class="form-group">
<label for="usr">Name:</label>
<input type="text" class="form-control" id="usr">
<input type="text" name="username" placeholder="input username">
</div>
<div class="form-group">
<label for="pwd">Password:</label>
<input type="password" class="form-control" id="pwd">
<input type="text" name="password" placeholder="input password">
</div>
</form>