1. 程式人生 > >Input標簽的美化,借用lable

Input標簽的美化,借用lable

top ott dex inpu adding for meta utf-8 absolut

<!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