css - input 标签为什么会多出1像素?

查看:369
本文介绍了css - input 标签为什么会多出1像素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

 * {        
            margin: 0px;
            padding: 0px;
        }
         .box {
             width: 200px;
             border: black 1px solid;
         }
         input {
             width: 198px;
             height: 18px;
             border: solid 1px red;
         }

   

<div class="box">
        <input type="text"/>
</div>

解决方案

input默认是是 inline-block 并默认与基线对齐,也就是baseline,加上 vertical-align: top;就行 或者 改成 display: block;

这篇关于css - input 标签为什么会多出1像素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆