【发布时间】:2016-06-08 02:03:44
【问题描述】:
我似乎无法让我的标题使标题居中在标题框的中间。它现在的样子,它有新闻、联系人和关于链接在框中的高处,而不是居中。
HTML:
<ul>
<li style="float:left"><a class="active" <a onclick="window.open(this.href, this.target);return false;" href="http://link/" target="link"> <img src="Logo.png" alt="Logo" style="width:125px;height:75px;"></a></li>
<li><a href="#news">News</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#about">About</a></li>
CSS:
ul {
list-style-type: none;
margin: 0;
padding: 10px;
overflow: hidden;
background-color: black;
}
li {
float: left;
}
li a {
display: inline-block;
color: white;
text-align: center;
padding: 14px 20px;
text-decoration: none;
}
li a:hover:not(.active) {
background-color: red;
}
.active {
background-color: black;
}
【问题讨论】:
-
你能发布一个div网站的链接吗?
-
澄清一下,您问的是垂直居中,不是水平居中?
-
是垂直居中
-
你可以在 jsfiddle 中发布你的代码吗?或者它是如何出现的截图?顺便说一句,你的 html 代码看起来不太好。