img和input顶部对不齐解决方法



页面中img和input顶部总对不齐,预览效果如下:



img和input设置vertical-align:middle即可解决:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style type="text/css">
    input, img {
        width:30px;
        height:30px;
        padding:10px 10px;
        margin:20px 20px;        
        border: 2px inset;
        vertical-align:middle;
    }
</style>
</head>
<body style="margin:0px 0px;">
    <input type="text" value="text" />
    <img src="/Images/search.png" />
</body>
</html>



评论: 0 | 引用: 0 | 查看次数: 5771
发表评论
登录后再发表评论!