简体   繁体   English

设置angular-ui-bootstrap复选框的样式(标签)

[英]Styling angular-ui-bootstrap checkbox (label)

I found this cool style here on stackoverflow link but I didn't know how to apply it to the chekcbox from angular-ui , well they're labels. 我在stackoverflow 链接上找到了这种很酷的样式,但是我不知道如何从angular-ui将该样式应用于chekcbox,它们是标签。

I tried adding them as classes, the effect has changed but the active class keep on messing up everything, and they looked weird. 我尝试将它们添加为类,效果发生了变化,但是活动的类继续使所有内容混乱,它们看起来很奇怪。

Here is the working plunkr... http://plnkr.co/edit/6CFc73JZTWujUQWnTrWr?p=preview 这是工作中的plunkr ... http://plnkr.co/edit/6CFc73JZTWujUQWnTrWr?p=preview

Basically just add this CSS, 基本上只需添加此CSS,

.btn-primary {
  background: url('http://lorempixel.com/output/people-q-c-50-50-1.jpg') no-repeat;
  height: 50px;
  width: 50px;
  display: block;
  border-radius: 50%;
  position: relative;
  transition: all 0.4s;
  border: solid 5px #FFF;
  box-shadow: 0 0 1px #FFF; /* Soften the jagged edge */
}
/* Provide a border when hovered and when the checkbox before it is checked */
.btn-primary:hover,
.btn-primary.active,
.btn-primary:focus{
  border: solid 5px #F00;
  box-shadow: 0 0 1px #F00; /* Soften the jagged edge */
}
/* 
- Create a pseudo element :after when checked and provide a tick
- Center the content
*/
.btn-primary.active::after {
  content: '\2714'; /*content is required, though it can be empty - content: '';*/
  display: block;
  height: 1.5em;
  width: 1em;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  margin: auto;
  color: #F00;
}
.btn-primary.active{
  background: url('http://lorempixel.com/output/people-q-c-50-50-1.jpg') no-repeat;
}

whereas in HTML, 而在HTML中,

<button type="button" class="btn btn-primary" ng-model="singleModel" btn-checkbox btn-checkbox-true="1" btn-checkbox-false="0"></button>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何绑定Angular-ui-bootstrap轮播控件的数据? - How to data bind Angular-ui-bootstrap carousel controls? 在Angular-UI-Bootstrap中修复轮播容器大小 - Fixing carousel container size in Angular-UI-Bootstrap Angular-ui-bootstrap datepicker指令 - 带到前面 - Angular-ui-bootstrap datepicker directive - bring to front 角度ui-bootstrap颜色更改的css导航不起作用 - css nav for angular-ui-bootstrap color change not working Angular-ui-bootstrap手风琴和折叠动画不起作用 - Angular-ui-bootstrap accordion and collapse animation not working 造型引导主题复选框与单行标签 - Styling bootstrap themed checkbox with label on single line 如何设计一个特定的angular-ui-bootstrap工具提示以使其更宽? - How do I style just one specific angular-ui-bootstrap tooltip to be wider? 如何在Angular-UI-Bootstrap中缩放轮播容器的大小 - How do you scale the carousel container size in Angular-UI-Bootstrap 苹果移动网络应用程序支持angular-ui-bootstrap模式滚动问题 - apple-mobile-web-app-capable angular-ui-bootstrap modal scrolling issue 为什么光标在angular-ui-bootstrap中没有变为指针/手上的Tabs,Pagination,Dropdown Toggle等? - Why doesn't cursor change to pointer/hand on Tabs, Pagination, Dropdown Toggle etc in angular-ui-bootstrap?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM