1.问题css样式:
<style>
#keywords{
height: 36px;
line-height: 36px;
width: 500px;
border: 1px solid #b0b0b0;
border-right:0px ;
}
#keywords:focus{
border: 1px solid rgb(71,145,255);
border-right:0px ;
}
input[type="button"]{
height: 40px;
line-height: 40px;
width: 98px;
border: 0px;
background-color: #3385fF;
color: white;
}
</style>body样式
<input type="text" name="keywords" id="keywords"><input type="button" value="百度一下">显示情况:

2.解决方法
分别给text和button的css加一个vertical-align:middle属性即可(注意高度)
解决后的显示情况:

本文介绍了解决CSS中输入框与按钮垂直居中对齐的问题,通过为text和button元素添加vertical-align:middle属性实现。同时给出了具体的样式代码示例。
2万+

被折叠的 条评论
为什么被折叠?



