我想只为选择的元素(或特定的 ID 或名称)提供白色背景的错误消息。我试过了:
select .error {
background-color: white;
}
这是选择的html:
<div class="col-md-2">
<div class="form-select-group">
<label class="whiteFont" for="selectState">Select Branch:</label>
<select class="form-control" id="selectState" name="selectState">
<option value="" disabled selected>Select your Branch</option>
<option>Option A</option>
<option>Option B</option>
</select>
</div>
</div>
我询问 ChatGPT 并得到:
select + .error {
background-color: white;
}
我以前没见过“+”。我看到的所有答案都是element.class。