
做搜索框布局时,发现对input标签无法紧贴在一起,中间会出现空隙
<div class="right-content"> <form action="" class="search"><input type="text" class="search_key" value="keywords"/><input type="submit" class="btn_submit" value="Go"/></form>
</div>
.right-content{width: 260px;background: #fff;float: left;margin-left: 10px;overflow: hidden;
}form{padding: 0;margin: 0;
}.search{width: 220px;height: 40px;padding: 20px;overflow: hidden;
}.search_key{width: 120px;height: 38px;line-height: 40px;font-size: 20px;color:#ddd;border: 1px solid #ddd;padding-right: 10px;padding-left: 40px;background: url(../img/search.gif) no-repeat 5px 5px ;
}.btn_submit{width: 44px;height: 40px;background: #ddd;font-size: 20px;color: #fff;border: 0;
}
图中分别为在firebug下,选中search_key和btn_submit时,元素对应的区域范围,中间会出现对应的空隙。
本来btn_submit宽度应为48px,但是由于中间的空隙占用,如果设置为48px,会出现btn_submit下移,我也没有搞清楚为什么。
最后通过对input添加浮动,才算正常
input{float:left;
}
这时btn_submit宽度为48px
本文发布于:2024-03-11 15:22:55,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/1710553121142170.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
| 留言与评论(共有 0 条评论) |