日期:2014-05-17  浏览次数:20587 次

求input,button对齐技巧
求input,button对齐技巧

HTML code

<!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>
<title>button</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
    *{padding:0;margin:0}
    body{padding:30px;}
    .search{
        height:50px;
        line-height:50px;
        background-color:tan;
    }
</style>
</head>
<body>
    <div class="search">
        <label>Input your key words</label>
        <input type="text" name="hello"/>
        <a href="javascript:;"><button>submit</button></a>
    </div>
</body>
</html>





------解决方案--------------------
可以写样式的嘛,定义一下input的宽高就行了。
------解决方案--------------------
font-family:Arial,sans-serif,Tahoma; /*规定同一字体*/
font-size:12px; /*规定同一字体大小*/
height:25px; /*解决Safari和Chrome下的高度问题*/
line-height:15px; /*协调height,让文字居中*/
overflow:visible; /*只有设置这个属性IE下padding才能生效*/
padding:0 0.5em; /*chrome、ff默认值;调整其值,让IE和其他浏览器的一样*/
------解决方案--------------------
加上
CSS code
input,button{ vertical-align:middle}