1

我正在制作一个正在建设的页面,其中包含一张背景图片和两张我在 Photoshop 中制作的图片。他们说的是“我们正在建设中”和“Quinncuatro Productions 的产品”。现在一切都完美地显示在页面上,但图像似乎真的很喜欢拥抱页面的左侧。这就是我现在所拥有的。我最简单的想法是现在的样式标签。我的第一个和第二个想法在标题评论中。难道我做错了什么?

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Think Klinck</title>
<style>
body{
background-image:url('metalBackground.jpg');
}
img{
margin-left:auto;
margin-top:auto;
}

/*This was the first idea that I had:
.UnderConstruction{
align:center;
margin-left:auto;
margin-top:auto;
}
.Q4Productions{
align:center;
margin-left:auto;
margin-top:auto;

And this was my second:
div.center{
margin-left:auto;
margin-top:auto;
}
*/
</style>
</head>

<body>

<div id="UnderConstruction" class="center">
<img src="UnderConstruction.gif" alt="ThinKlinch.com is regretfully under construction.">
</div>

<div id="Q4Productions" class="center">
<img src="Q4Productions.gif" alt="A product of Quinncuatro Productions.">
</div>

</body>
</html>
4

1 回答 1

1
#UnderConstruction,#Q4Productions{
    text-align:center;
}​

或者

.center{
    text-align:center;
}​

这将使您的图像在 div 中居中。

于 2012-10-13T21:02:11.027 回答