【发布时间】:2014-09-11 13:33:51
【问题描述】:
我想在固定页眉中左右对齐并垂直居中对齐文本。现在它当前居中。但它以line height 为中心,我不确定这是否是正确的做法。
这里是 JSFIDDLE:http://jsfiddle.net/bassmu1x/1/
<body>
<div class="header">
<ul class="links">
<li>Archive</li>
<li>About</li>
<li>?</li>
<li>Submit</li>
</ul>
<div class="home">home</div>
<div style="clear: both;"></div>
</div>
.header {
background: #f5f5f5;
width: 100%;
display: block;
position: fixed;
height: 75px;
}
ul li {
list-style-type: none;
display: inline;
float: right;
text-transform: uppercase;
padding-right: 3px;
line-height: 35px;
}
.home {
float: left;
text-transform: uppercase;
padding-right: 3px;
line-height: 35px;
}
【问题讨论】:
-
你关心你的 HTML 元素的顺序吗? home 元素可以出现在标记中的 ul 元素之前吗?