checkbox复选框美化代码实例

快乐打工仔 分类:实例代码

默认状态下,checkbox复选框并不美观,虽然满足基本的需要。

但是在美观度要求很高的网站中,实在是不堪入目,所以需要进行格外的美化。

下面分享一个代码实例,它实现了复选框的美化效果。

代码如下:

<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<meta name="author" content="http://www.pipipi.net/" />
<title>前端教程网</title>
<style>
.box {
  width:20px;
  height:20px;
  float:left;
  cursor:pointer;
  margin-left:10px;
  text-align:center;
  background-image:url(demo/CSS/img/checkbox.gif);
  background-repeat: no-repeat;
  background-position:0 0;
}
.antzone{
  opacity: 0;
  cursor: pointer;
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
  filter: alpha(opacity=0);
}
.on_check{
  background-position:0 -21px;
}
</style>
</head>
<body>
<div class="box on_check">
  <input type="checkbox" style="height:20px;width:20px;" class="antzone">
</div>
</body>
</html>
一线大厂高级前端编写,前端初中阶面试题,帮助初学者应聘,需要联系微信:javadudu

回复

我来回复
  • 暂无回复内容