img图片中间莫名出现空隙

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <meta http-equiv="X-UA-Compatible" content="ie=edge">

    <title>图片并排</title>

    <style type="text/css">

     *{

     margin:0px;margin: 0px;

     }

     .main{

     width: 800px;

     }

     img{

     width:25%;

     }

    </style>

</head>

<body>

    <div class="main">

        <img src="particles-triangles-shattered-3d-13901-thumb.jpg" alt="">

        <img src="particles-triangles-shattered-3d-13901-thumb.jpg" alt="">

        <img src="particles-triangles-shattered-3d-13901-thumb.jpg" alt="">

        <img src="particles-triangles-shattered-3d-13901-thumb.jpg" alt="">

    </div>

</body>

</html>

效果

https://img2.mukewang.com/5abf02880001b7ed08570323.jpg

https://img2.mukewang.com/5abf02ab000175f101940175.jpg

疑问:每张图片都是200,没有margin,但为什么有间隙

maturity_process
浏览 1446回答 1
1回答

习惯受伤

是由空格或空行造成的,把上边的这一段:        <img src="particles-triangles-shattered-3d-13901-thumb.jpg" alt="">         <img src="particles-triangles-shattered-3d-13901-thumb.jpg" alt="">         <img src="particles-triangles-shattered-3d-13901-thumb.jpg" alt="">         <img src="particles-triangles-shattered-3d-13901-thumb.jpg" alt="">改成:<img src="particles-triangles-shattered-3d-13901-thumb.jpg" alt=""><img src="particles-triangles-shattered-3d-13901-thumb.jpg" alt=""><img src="particles-triangles-shattered-3d-13901-thumb.jpg" alt=""><img src="particles-triangles-shattered-3d-13901-thumb.jpg" alt="">
打开App,查看更多内容
随时随地看视频慕课网APP