原本的checkbox看起來很小一個,以下為客製化的checkbox:
- 隱藏原本的checkbox
- 將label調整成像一個checkbox的外觀
- 用FontAwesome來顯示打勾
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
<style>
#ckb1{
display:none;
}
#ckb1 + label[for="ckb1"]{
border:1px solid gray;
width:26px;
height:26px;
border-radius:4px;
display:inline-block;
}
#ckb1:checked + label[for="ckb1"]:before{
color:green;
font-family:FontAwesome;
content:'\f00c';
position:ablolute;
font-size:26px;
line-height:28px;
}
</style>
</head>
<body>
<input type="checkbox" id="ckb1"/>
<label for="ckb1"></label>
</body>
</html>