Nat*_*son 3 html css text hyperlink font-size
由于某种原因,我的文本的可点击区域的高度比 div 和“a”标签设置的高度大得多。如果运行代码片段并将鼠标悬停在文本下方和下方,您将看到可点击区域比 div 和“a”标签大得多。有任何想法吗?
谢谢。
.title {
display: flex;
position: absolute;
background-color: red;
z-index: 6;
height: 7em;
width: 20em;
bottom: 11.25vh;
text-align: left;
}
.title a {
font-size: 108px;
line-height: 108px;
text-decoration: none;
color: #000;
font-family: 'Inknut Antiqua', serif;
}Run Code Online (Sandbox Code Playgroud)
<link href="https://fonts.googleapis.com/css?family=Inknut+Antiqua" rel="stylesheet">
<div class="title">
<a href="javascript:;">Work</a>
</div>Run Code Online (Sandbox Code Playgroud)
这是因为您设置的行高实际上比默认行高小得多。(如果删除,line-height: 108px;您会发现它要大得多)。
如果您不希望链接超出 div 大小,则可以添加overflow: hidden到div。.title
.title {
display: flex;
position: absolute;
background-color: red;
z-index: 6;
height: 7em;
width: 20em;
bottom: 11.25vh;
text-align: left;
overflow: hidden;
}
.title a {
font-size: 108px;
line-height: 108px;
text-decoration: none;
color: #000;
font-family: 'Inknut Antiqua', serif;
}Run Code Online (Sandbox Code Playgroud)
<link href="https://fonts.googleapis.com/css?family=Inknut+Antiqua" rel="stylesheet">
<div class="title">
<a href="http://www.google.com">Work</a>
</div>Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1170 次 |
| 最近记录: |