なぜvertical-align: middle;
は私のh1で動作していませんか? ul
はh1
と一致していません。垂直整列:中間が機能していませんか?
#logo {
\t color: white;
\t display: inline;
\t vertical-align: middle;
}
ul {
\t padding: 20px;
\t background: rgba(0,0,0,.5);
}
#title {
\t position: absolute;
\t text-align: center;
\t color: white;
\t font-size: 50px;
\t top: 100px;
}
#navbar {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-image: url('../img/bg.jpg');
background-repeat: no-repeat;
background-size: 100% 100%;
height: 600px;
}
li {
\t float: right;
\t display: inline;
}
li a {
\t display: inline;
\t padding: 10px 10px 10px 20px;
\t text-decoration: none;
\t color: white;
}
<div id="navbar">
\t \t <ul>
\t \t \t <h1 id="logo">Jordan Baron</h1>
\t \t \t <li><a href="#">About Me</a></li>
\t \t \t <li><a href="#">Contact</a></li>
\t \t \t <li><a href="#">Projects</a></li>
\t \t </ul>
\t \t <h1 id="title">Freelance Web Developer</h1>
\t </div>
(1)あなたは 'ul'の子として' h1'を置くべきではありません。 [これは無効なHTMLです。](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ul)(2)['vertical-align'プロパティ](https:// developer。 mozilla.org/en-US/docs/Web/CSS/vertical-align)は、インラインレベル要素と表セル要素にのみ適用されます。 –
通常、ページごとに 'h1'しかありません。意味的には、その順序付けられていないリストにあなたの名前を入れるのは意味をなさない。 – hungerstar
代わりに何を使うべきですか? –