繁体   English   中英

如何获得这些图像在页面上居中的位置?

[英]How do I get these images centered on the page?

我正在制作一个正在建设的页面,其中包括背景图片和我在Photoshop中制作的两个图片。 他们说的是“我们正在建设中”和“ Quincuuatro 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>
#UnderConstruction,#Q4Productions{
    text-align:center;
}​

要么

.center{
    text-align:center;
}​

这将使图像在div中居中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM