Twitter Bootstrap收音机/复选框 - 如何把字形 [英] Twitter Bootstrap radio/checkbox - how to put glyphicon

查看:131
本文介绍了Twitter Bootstrap收音机/复选框 - 如何把字形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用TB,是否可以设置收音机或复选框的样式,使其显示字形而不是收音机或复选框的默认样式?我想使用 glyphicon glyphicon-star 表示未选中,然后 glyphicon glyphicon-star-empty 表示选中。

Using TB, is it possible to style the radio or checkbox so that it shows a glyphicon instead of the default style for radio or checkbox? I want to use a glyphicon glyphicon-star to indicate unchecked, then glyphicon glyphicon-star-empty to indicate checked.

推荐答案

在官方网站上,javascript部分有将复选框和单选按钮组设置为按钮组的示例。它位于按钮部分此处

On the official website, the javascript section has examples of styling groups of checkboxes and radio buttons as buttons groups. It's under the buttons section here.

而不是让按钮中的文本读为选项1,你会放置你的字形。

Instead of having text inside the button that reads "Option 1", you would place your glyphicon instead. If you wanted only one checkbox, I suppose you could eliminate the button group and just go with a single button.

要删除按钮外观,只显示您的图标,请使用btn-link类。

To remove the button appearance and only show your icon, use the "btn-link" class.

我没有尝试过,但我没有理由不能工作。

I haven't tried this myself, but I see no reason for it to not work.

这篇关于Twitter Bootstrap收音机/复选框 - 如何把字形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆