Bootstrap input-group-addon icons for non-inputs

夙愿已清 提交于 2019-12-13 05:16:32

问题


Bootstrap has a built-in icon for buttons: http://getbootstrap.com/components/#input-groups

I was wondering if it was possible to keep this style of icon, but not for inputs? For example I want to have an icon appear as part of the panel title in the same style: http://getbootstrap.com/components/#panels, and possible also to be able the change the background color of the icon section?

What I need: http://imgur.com/fRacpMa

So I guess this is not a built in functionality. How would I about building a CSS for this myself?


回答1:


Yes, see the Glyphicons section of the documentation. Demo

<div class="panel panel-default">
  <div class="panel-heading">
    <h3 class="panel-title"><span class="glyphicon glyphicon-music"></span> Panel title</h3>
  </div>
  <div class="panel-body">
    Panel content
  </div>
</div>

CSS to change the color.

.glyphicon {
    color: #ff0000;
}



回答2:


For everyone searching for similar solutions.

I have found this bootstrap snippet that modifies the panel behavior to work horizontally:

http://bootsnipp.com/snippets/featured/panel-horizontal



来源:https://stackoverflow.com/questions/23521488/bootstrap-input-group-addon-icons-for-non-inputs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!