当前位置:   article > 正文

复选框修改样式为圆形_js圆形checkbox

js圆形checkbox

复选框修改样式为圆形

http://www.jq22.com/webqd5287,由于复选框默认样式为矩形,修改为圆形需要通过伪类实现

html部分

<input name="checkbox" value="Item 1" type="checkbox" class="tui-checkbox ">
<input name="checkbox" value="Item 1" type="checkbox" class="tui-checkbox ">
<input name="checkbox" value="Item 1" type="checkbox" class="tui-checkbox ">
  • 1
  • 2
  • 3

css部分

//设置选中背景
.tui-checkbox:checked {
	background:#1673ff
}
//设置复选框样式
.tui-checkbox {
	width:25px;
	height:25px;
	background-color:#ffffff;
	border:solid 1px #dddddd;
	-webkit-border-radius:50%;
	border-radius:50%;
	font-size:0.8rem;
	margin:0;
	padding:0;
	position:relative;
	display:inline-block;
	vertical-align:top;
	cursor:default;
	-webkit-appearance:none;
	-webkit-user-select:none;
	user-select:none;
	-webkit-transition:background-color ease 0.1s;
	transition:background-color ease 0.1s;
}
//设置伪类,即显现的对勾样式
.tui-checkbox:checked::after {
	content:'';
	top:5px;
	left:5px;
	position:absolute;
	background:transparent;
	border:#fff solid 2px;
	border-top:none;
	border-right:none;
	height:6px;
	width:10px;
	-moz-transform:rotate(-45deg);
	-ms-transform:rotate(-45deg);
	-webkit-transform:rotate(-45deg);
	transform:rotate(-45deg);
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/292568
推荐阅读
  

闽ICP备14008679号