在 select 中的选项中添加超棒的字体图标
Add font-awesome icon to option in select
是否可以在 <select>
中向 <option>
添加超棒的字体图标?
<body ng-app>
<i class="fa fa-camera-retro"></i> fa-camera-retro<br>
<select ng-model="choice" class="fa">
<option value="">Choose</option>
<option value="icon camera">icon camera</option>
<option value="icon bell">icon bell</option>
<option value="icon bicycle">icon bicycle</option>
</select>
由于 font-awesome 图标是字体,它们可以通过 Unicode 添加到选项中:
<script src="//unpkg.com/angular/angular.js"></script>
<link rel="stylesheet" href="//unpkg.com/font-awesome/css/font-awesome.css">
<body ng-app>
<i class="fa fa-camera-retro"></i> fa-camera-retro<br>
<select ng-model="choice" class="fa">
<option value="">Choose</option>
<option value=" camera"> camera</option>
<option value=" bell"> bell</option>
<option value=" bicycle"> bicycle</option>
</select>
<br>
Choice = <span class="fa">{{choice}}</span>
<br><span class="fa">--</span>
</body>
是否可以在 <select>
中向 <option>
添加超棒的字体图标?
<body ng-app>
<i class="fa fa-camera-retro"></i> fa-camera-retro<br>
<select ng-model="choice" class="fa">
<option value="">Choose</option>
<option value="icon camera">icon camera</option>
<option value="icon bell">icon bell</option>
<option value="icon bicycle">icon bicycle</option>
</select>
由于 font-awesome 图标是字体,它们可以通过 Unicode 添加到选项中:
<script src="//unpkg.com/angular/angular.js"></script>
<link rel="stylesheet" href="//unpkg.com/font-awesome/css/font-awesome.css">
<body ng-app>
<i class="fa fa-camera-retro"></i> fa-camera-retro<br>
<select ng-model="choice" class="fa">
<option value="">Choose</option>
<option value=" camera"> camera</option>
<option value=" bell"> bell</option>
<option value=" bicycle"> bicycle</option>
</select>
<br>
Choice = <span class="fa">{{choice}}</span>
<br><span class="fa">--</span>
</body>