我对网页设计有点新鲜。我有一个包含两个主要部分的网页 - 带有徽标的文字和下面的居中图像。CSS图像未对齐
为了使徽标浮动在第一节文本中,我添加了float: left; margin: 4px;
风格的图像。
下一个图像居中之前(模板中存在“居中”风格)。
但现在它错误地与上面的部分文本而不是页面中心的位置对齐。虽然这个错误发生在IE中,但Firefox很好。 如何使其正确对齐?
页代码是:
<img src="images/logo.png" alt="Product Logo" style="float: left; margin: 4px;"/>
<p>All you need to make it work is to install the software and run it. The result will appear automatically!</p>
<img class="centered" src="screenshots/screenshot_small.png" alt="Product Screenshot" title="Product Screenshot" style="text-align:center;" />
<p class="caption">Product Screenshot</p>
的 “居中” 类被定义为如下:
img.centered {
display:block;
margin:0 auto;
padding:0;
text-align:center;
}
感谢。
将您的css/html发布到pastebin.com并为您提供页面快照。从描述中很难看到发生了什么。 – 2011-02-12 14:39:09