【发布时间】:2015-12-23 14:30:35
【问题描述】:
这是我正在使用的:
<div class="page-header">
<h1>About Us</h1>
::after /* <-- This is just to illustrate where the :after is */
</div>
这是我的样式(它是 SCSS,如果您不习惯看到嵌套样式的话。):
.page-header{
display: table;
width: 100%;
vertical-align: middle;
padding-right: 2em;
h1{
display: table-cell;
min-width: 156px;
vertical-align: middle;
}
&:after{
display: table-cell;
content: "";
width: 86%;
border-top: 3px solid #635c4d;
vertical-align: middle;
}
}
由于某种原因,我似乎无法让 :after 元素在中间垂直对齐。它只是停留在顶部。有任何想法吗?提前致谢。
【问题讨论】:
标签: css vertical-alignment css-tables