我有一个像下面这样的搜索框,我正在使用引导程序来提供灵活的布局。如何使用像下面这样的设计并确保我可以获得可拉伸的搜索框。
问问题
1643 次
2 回答
1
像这样添加您的 Html 部分
<div class="searchbox">
<input class="lightsearch" type="text" name="s" onfocus="doClear(this)" value="">
</div>
css部分,下载一个搜索框图片并替换为名称
.searchbox input.lightsearch {
background: url("images/lightsearch.png") no-repeat scroll 0 0 transparent;
border: 0 none;
color: #575757;
font-size: 11px;
height: 19px;
margin-top: 24px;
padding: 2px 5px 2px 24px;
width: 170px;
}
于 2013-05-27T11:43:05.163 回答
1
您需要一个容器来放入您的输入框,并在其中放置一个前端和结束 div。根据浏览器兼容性,您可能需要添加更多 div 以确保您的输入框在 IEX7/8 等浏览器中正确显示。
因此,您将拥有以下内容:
<form class="searchbox">
<input type="text" class="text" />
<input type="submit" class="submit" />
</form>
附上以下示例 CSS
form.searchbox { background:url(leftside_image.gif) 0 0 no-repeat; padding-left:15px; }
form.searchbox input.text { border:none; border-top:1px solid #999; border-bottom:1px solid #999; height:25px; line-height:25px; padding:0 5px; }
form.searchbox input.submit { background:url(rightside_image.gif); }
于 2013-05-27T09:27:14.080 回答