码迷,mamicode.com
首页 > 其他好文 > 详细

解决input和button错位(不齐)问题

时间:2019-02-20 11:31:33      阅读:261      评论:0      收藏:0      [点我收藏+]

标签:body   put   错位   javascrip   nbsp   top   方法   auto   inf   

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style type="text/css">
        *{
            margin: 0;
            padding: 0;
        }
        .box{
            width: 300px;
            height: 300px;
            padding: 20px;
            background-color: pink;
            margin: 30px auto;
        }
        input{
            width: 120px;
            height: 20px;
            border: none;
            padding: 5px;
            /*vertical-align: top;*/
            border: 2px solid green;
        }
        button{
            width: 40px;
            height: 34px;
            border: none;
            background-color: green;
            padding: 0 5px;
            /*vertical-align: top;*/
            color: #fff;
        }
    </style>
</head>
<body>
<div class="box">
    <input type="text"><button type="button">查询</button>
</div>
<script type="text/javascript">

</script>
</body>
</html>

上面代码会出现这种效果:

  技术图片

 解决方法:给两个同时加上vertical-align:top;即可,把上面代码的注释去掉即可;

最后;
技术图片

 

解决input和button错位(不齐)问题

标签:body   put   错位   javascrip   nbsp   top   方法   auto   inf   

原文地址:https://www.cnblogs.com/alex-xxc/p/10405341.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!