码迷,mamicode.com
首页 > 其他好文 > 详细

Input标签的美化,借用lable

时间:2017-10-18 13:45:42      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:before   border   bottom   input   公司   ble   nbsp   ati   index   

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
*{
margin:0;padding:0;list-style: none;
}
li{
position: relative;
height:50px;
}
input{
display: none;
}
label{
display: inline-block;
position: relative;
}
label::before{
display: inline-block;
content: "注册公司";
height: 40px;
line-height: 40px;
padding:0 10px;
position: relative;
top:0;
border: 1px solid #000;
}
label>i::before{
content: "";
display: none;
position: absolute;
bottom: 0;
right: 0;
width:13px;
height:13px;
background: url(images/xiajiao.png) no-repeat ;
z-index: 999;
}
input[type="radio"]:checked+label::before{
border: 1px red solid;
}
input[type="radio"]:checked+label>i::before{
display: block;
}
</style>
</head>
<body>
<ul>
<li>
<input type="radio" name="1" id="ds"/>
<label for="ds"><i></i></label>
<input type="radio" name="1" id="ds1"/>
<label for="ds1"></label>
</li>
</ul>
</body>
</html>

 

通过添加label标签,隐藏input,从而给label加样式,达到美化input框的效果。

其中简单的样式添加,通过:before完成。

Input标签的美化,借用lable

标签:before   border   bottom   input   公司   ble   nbsp   ati   index   

原文地址:http://www.cnblogs.com/circleline/p/7686180.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!