<分区>
<分区>
我在检查 firefox 和 chrome 上的元素时发现 a
元素比其中的图像长。图片为 102px,a
为 106.4px。我想知道额外的 4.4 像素从何而来?
原始图像为 102 像素 x 102 像素。
这是我的代码(也在 jsfiddle https://jsfiddle.net/g5nsL52a/ 上):
header {
min-height:102px;
text-align:center;
font-family: "Felix Titling Regular", Times, serif;
}
header a {
display:inline-block;
position:absolute;
left:0;
}
header h1 {
display:inline-block;
position:relative;
top:29px;
font-size:300%;
text-transform:capitalize;
}
<header>
<a href="index.html">
<img src="https://images.pexels.com/photos/430205/pexels-photo-430205.jpeg" width="102" height="102" alt="Godfather Logo" title="Godfather Small Logo"/>
</a>
<h1> loyal capos to the don </h1>
</header>
最佳答案
header a{
display:inline-block;
position:absolute;
left:0;
height:102px;
width:102px;
padding:0;
margin:0;
}
关于html - CSS <a> 标签比里面的图片长吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47952120/