为什么插入图片,container下面会产生大概2px的间距?

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>document</title>
    <style>
    
    
         html,body,ul,li,ol,dl,dd,dt,p,h1,h2,h3,h4,h5,h6,form,img {
            margin: 0;
            padding: 0
        }
        
        html,body{
            height: 100%;
        }
        
        .container{
            width: 1190px;
            background: red;
            margin: 0 auto;
        }
        
        .container .fira{
            display: block;
            text-decoration: none;
        }
        
        .container .fira img{
            width:160px;
            height:58px;
        }
    </style>
</head>
<body>
    <div class="wrap">
        <div class="container">
            <a class="fira" href="#"><img src="img/pic.jpg" alt="" /></a>
        </div>
    </div>
</body>
</html>

图片描述

阅读 3.1k
4 个回答
img {
    display: block;
}

方案1:
给img加display:block

方案2:
给img加vertical-align:bottom

图挂了?加font-size = 0 试试

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题