2017-01-27 19 views
0

フォーム内でタイプテキストのブートストラップ入力にCSSを適用しようとして1時間を費やしました。ここに私のコードは次のとおりです。ブートストラップ入力タイプのテキストにカスタム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]一部を削除した場合、すべてがOKであるということです。

JSFiddle

+0

申し訳ありませんが、全く不可能 –

答えて

2

あなたはinput[type=text]の間のスペースを削除する必要があります。

input[type=text] { 
 
    background-color: red !important; 
 
}
<input type="text"/> 
 
<input type="password"/>

+0

をbackground'。なぜなら、バックスペースがあるからです。 –

0

あなたのバックグラウンドのスペルが間違っているとスペースを削除します。

input [type=text] { 
    barckground-color: red !important; 
} 

正しい入力をしてください。

input[type=text] { 
    background-color: red !important; 
} 
0

こんにちは私はあなたを助けることができるこの1人の希望を試してみてください:仕事 `における誤植について

<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> 
関連する問題