Here's a link to the page.在一个背景图像
试图垂直&定心文本水平居中的背景图像内的hgroup。也许我会以错误的方式放置图像。正如你可以看到我已经尝试了各种不同的方法。 margin:auto,vertical-align:center等都不起作用。
我也试图将徽标居中放在页面中间,但仍然对着顶部齐平。
任何帮助非常感谢!
header img {
margin: 0 auto;
height: 167px;
width: 177px;
}
.welcome {
height: 650px;
background: url(images/twotrees.jpg);
background-size: 100% auto;
background-repeat: no-repeat;
vertical-align: middle;
}
.welcome hgroup {
vertical-align: middle;
}
.welcome h1 {
color: #fff;
font-size: 64px;
vertical-align: middle;
}
.welcome h2 {
font-family: kepler std;
font-size: 48px;
color: #fff;
font-style: italic;
font-weight: normal;
text-align: center;
text-transform: none;
vertical-align: middle;
}
<body>
<header>
<a href="/index.html"><img src="images/ttc_logo.png" width="177px" height="167px" alt="Two Trees Creative Logo"></a>
<nav>
<ul>
<li><a href="index.html">Home</a> |</li>
<li><a href="about.html">About</a> |</li>
<li><a href="portfolio.html">Portfolio</a> |</li>
<li><a href="contact.html">Contact</a></li>
</ul>
</nav>
<div class="welcome">
<hgroup>
<h1>Designing Your World</h1>
<h2>One pixel at a time.</h2>
</hgroup>
</div>
</header>
附上一些图片,以显示您期望得到什么,以及您有什么实际结果!所以我和其他人可以帮助更好。 – Zich
有一个链接到该网站顶部的评论@Zich –
你知道吗? hgroup看起来以我为中心。 –