use*_*546 8 html css3 twitter-bootstrap glyphicons
我有这个代码
<div class="btn-group" dropdown>
<button type="button" class="btn btn-danger">Action</button>
<button type="button" class="btn btn-danger dropdown-toggle" dropdown-toggle>
<span class="caret"></span>
<span class="sr-only">Split button!</span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)
看起来像

我想像这样添加像文本的cog insteaqd这样的图标

我试过这个
<button type="button" class="glyphicon glyphicon-cog"></button>
但没有工作
JHS*_*JHS 12
对于一个按钮,图标需要作为按钮的内容进入按钮内部,因此<button type="button" class="glyphicon glyphicon-cog"></button>
应该是
<button type="button" class="btn">
<span class="glyphicon glyphicon-cog"></span>
</button>
Run Code Online (Sandbox Code Playgroud)
编辑:要在Bootstrap中添加插入符号,请使用 <span class="caret"></span>
因此,获得带有cog和dropdown插入符号的按钮的最终结果是:
<button type="button" class="btn">
<span class="glyphicon glyphicon-cog"></span><span class="caret"></span>
</button>
Run Code Online (Sandbox Code Playgroud)
当我将该代码粘贴到Bootstrap的主页时,我得到了这个:
