Bootstrap 图标
2017-03-22 23:18
417 查看
小图标组件
Bootstrap提供了的小图标:可参考Bootstrap中文官网组件
原理
Bootstrap框架中的图标都是字体图标,是通过css3的@font-face属性配合字体来实现icon效果的。@font-face { font-family: ‘Glyphicons Halflings‘; src: url(‘../fonts/glyphicons-halflings-regular.eot‘); src: url(‘../fonts/glyphicons-halflings-regular.eot?#iefix‘) format(‘embedded-opentype‘), url(‘../fonts/glyphicons-halflings-regular.woff‘) format(‘woff‘), url(‘../fonts/glyphicons-halflings-regular.ttf‘) format(‘truetype‘), url(‘../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular‘) format(‘svg‘); }
这些字体取自于Bootstrap框架中fonts目录(存放用于制作icon的字体文件),通过给元素添加“glyphicon”类名来实现,然后通过伪类“:before”的“content”属性调取对应的icon编码。
.glyphicon { position: relative; top: 1px; display: inline-block; font-family: ‘Glyphicons Halflings‘; font-style: normal; font-weight: normal; line-height: 1; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } .glyphicon-asterisk:before { content: "\2a"; } <!--调用--> <span class="glyphicon glyphicon-asterisk"></span>
使用
不与其他组件混合使用,应使用< i>或< span>标签配合使用图标类只能应用在不包含文本内容或子元素的元素上
使用小图标
<span class="glyphicon glyphicon-search"></span> <i class="glyphicon glyphicon-asterisk"></i>
结合按钮
<button class="btn btn-default btn-lg"> <span class="glyphicon glyphicon-star"></span> </button>
相关文章推荐
- 在Yii中解决引入本地Bootstrap文件字体图标无法显示问题
- iconfont字体图标的使用方法--超简单! 我之前因为项目用bootstrap比较多,所以使用font awesome字体图标比较多,后来接触到了iconfont,发现想要的什么图标都有,还可以
- 使用bootstrap图标做链接
- Bootstrap--组件之Glyphicons字体图标
- Bootstrap框架中的字形图标的理解
- Bootstrap中怎样引入Buttons图标?
- Bootstrap图标
- Bootstrap图标引用方法
- bootstrap中图标样式caret实现各种三角形
- bootstrap系列之八小图标
- bootstrap-为水平排列的表单和内联表单设置可选的图标
- bootstrap中可用的图标集
- Bootstrap — Glyphicons字体图标
- Bootstrap 图标
- bootstrap --字体图标的设置 按钮组件
- bootstrap图标
- Bootstrap表单验证 formValidation 调整反馈图标位置
- bootstrap初体验--所有图标链接
- BootStrap中的Fontawesome 图标
- BootStrap自定义小图标