小编jac*_*der的帖子

内联块元素的行高问题

出于某种原因,这些锚标签不应用它们自己的行高,而是使用父标记.

它仅适用于锚标记的行高高于其父标记或者display属性设置为block的情况.

我是否错过了有关行高属性的内容?

.container {
  max-width: 200px;
  border: 2px black solid;
  line-height: 5;
}

.container>a {
  /*display: block; if uncomment this the line-height will work*/
  line-height: 1.5;
  width: 100%;
}
Run Code Online (Sandbox Code Playgroud)
<div class=container>
  <a>First</a>
  <a>Second</a>
  <a>Third</a>
  <a>Fourth</a>
</div>
Run Code Online (Sandbox Code Playgroud)

html css

4
推荐指数
1
解决办法
363
查看次数

标签 统计

css ×1

html ×1