我有一个下拉菜单,我需要将下拉菜单中的第一个值设置为粗体。下拉代码如下。
<div class="col-xs-3">
<select-box id="ad-version-select" options="curItem.stats.version" model="state.version" initial="All" change="watchvalue()" ng-disabled="state.partialDisable"></select-box>
</div>
<select class="form-control" ng-model="model" ng-change="change()">
<option ng-if="initial.length" ng-bind="initial" value=""></option>
<option ng-repeat="option in options" value="{{getValue()}}" ng-selected="model==getValue()" ng-bind="getTitleVariable()"></option>
</select>
我试过
<style>
div.col-xs-3>div:first-child {
font-weight: bold;
}
</style>
但是没有用。我不知道如何只将第一个值设为粗体。我不能使用 jquery。有人可以帮我解决这个问题吗?
最佳答案
需要在您的 CSS 选择器中进行更改。您应该选择选项的第一个子项以将其设为粗体。
option:first-child
{
font-weight: bold;
}
这是样本 Fiddle
希望这对您有所帮助。
-帮助:)
关于javascript - 在 Angular js中将下拉列表中的第一个值设为粗体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34868338/