您的位置:首页 > Web前端 > CSS

css使用背景图片制作搜索框

2015-11-30 14:49 736 查看
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>使用图片制作搜索框</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
<style>
.searchCon {
width: 330px;
height: 35px;
background: url(images/search.jpg) no-repeat;
position: relative;
}

.searchCon input.inputText{
width: 235px;
height: 24px;
line-height: 24px;
position: absolute;
top: 4px;
left: 5px;
border: 0;
border: none;
background: none;
}
.searchCon input.inputButton {
width: 73px;
height: 33px;
position: absolute;
left: 257px;
top: 1px;
cursor: hand;
cursor: pointer;
/* filter: alpha(opacity: 0);
opacity: 0;  */
border: 0;		/*隐藏默认属性*/
background: none;   /*隐藏默认属性*/
}
</head>
<body>
<div class="searchCon">
<input type="text" class="inputText">
<input type="button" class="inputButton">
</div>
<!--使用背景图片的搜索框思路
使背景图片中的输入框和搜索按钮与实际输入框和搜索按钮的位置重合,在完成输入框和搜索按钮的尺寸、文本的调整后,使得一切边框皆为0、一切挡住背景图片的元素均为透明即可。
-->
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  css 背景图片 搜索框