效果图如图所示:
代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>纯css制作搜索框</title>
<style>
*{
margin: 0;
padding: 0;
border: none;
}
.x{
display: inline-block;
margin-top: 200px;
margin-left: 300px;
position: relative;
}
.k{
width: 536px;
height: 38px;
border: 1px solid #cccccc;
float: left;
box-sizing: border-box;
}
.n{
width: 102px;
height: 38px;
line-height: 40px;
float: left;
background-color: #38f;
font-size: 16px;
/*鼠标悬停按钮上方,光标成手指样式*/
cursor: pointer;
}
.t{
z-index: 1;
position: absolute;
right: 113px;
top: 50%;
margin-top: -8px;
height: 16px;
width: 18px;
background: url("images/bd.png");
cursor: pointer;
}
</style>
</head>
<body>
<span class="x">
<input type="text" class="k"><input type="button" value="百度一下" class="n">
<span class="t"></span>
</span>
</body>
</html>