图片和它下面文字产生的距离的原因, 虽然可以通过设置a的font-size:0;来解决,不知道原因太纠结,
距离问题
<!DOCTYPE html>
<html lang="en">
<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>Document</title>
<style>
* {
padding: 0;
margin: 0;
border: 0;
}
html {
font-size: 50px;
}
a {
float: left;
width: 150px;
height: 140px;
background: blueviolet;
text-align: center;
}
a img {
display: block;
width: 88px;
height: 88px;
margin: 0 auto;
}
a span {
font-size: 25px;
}
</style>
</head>
<body>
<a>
<img src="./image/jd.png" alt="">
<span>距离问题</span>
</a>
</body>
</html>
input和父元素顶部的距离,设置font-size:0; 也可以解决。什么原因产生的距离?
<!DOCTYPE html>
<html lang="en">
<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>Document</title>
<style>
* {
padding: 0;
margin: 0;
border: 0;
}
div {
background: blueviolet;
text-align: center;
}
</style>
</head>
<body>
<div>
<input type="text">
</div>
</body>
</html>