DIV+CSS教程_以最简单的代码写出这样的搜索框
以最简单的代码写出这样的搜索框
突然想到一个办法,来避免IE7的background-attachment,而且9楼代码的max-length没有考虑中文字符的宽度问题:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>
<style type="text/css">
#login{width:415px;height:36px;position:relative;background:#FC9A0C;}
#login .key{width:324px;height:25px;overflow:hidden;border:solid 1px #E68A0D;position:absolute;left:5px;top:4px;padding:0 5px;background:#fff url(http://home.blueidea.com/image/app/homepage.gif) 310px center no-repeat;}
#login .key input{width:324px;height:25px;overflow:hidden;background:none;padding:0;line-height:25px;border:none;color:#555;padding:0;}
#login .smt_area{width:69px;height:27px;position:absolute;right:5px;top:4px;background:url(http://home.blueidea.com/attachment/201003/25/381636_1269525914BoDu.png);}
#login .smt_area input{filter:Alpha(opacity=0);opacity:0;width:69px;height:27px;cursor:pointer;}
</style>
</head>
<body>
<div id="login">
<label class="key"><input type="text" name="key" /></label>
<label class="smt_area"><input type="submit" value="Submit" onfocus="this.blur()" /></label>
</div>
</body>
</html>
应该算完美的解决方法了!