0
我有三个div,我想水平对齐,也对齐在页面的中心。Floating Divs and centering the Div
我有什么是接近我想要的,但它不是在页面中心,它也不会与浏览器窗口调整大小。
我还是新来的HTML和CSS,所以任何建议将不胜感激。
#wrapper {
width: 90%;
min-width: 768px;
max-width: 1280px;
margin-right: auto;
margin-left: auto;
}
.projectlogo {
float: left;
margin: 20px;
width: 122px;
height: 113px;
}
.projectsite {
border-radius: 50%;
border: solid #DFF0D8;
float: left;
margin: 20px;
width: 126px;
height: 126px;
}
.description {
float: left;
margin: 20px;
width: 400px;
}
#gallery {
width: 980px;
height: 240px;
font-size: 1.25em;
}
#gallery h2 {
text-align: center;
}
<div id="wrapper">
<main>
<div id="gallery">
<h2>My Work</h2>
<img class="projectlogo" src="images/rotary_logo.png" width="122" height="113" alt="" />
<div class="description">
<p>Rotary Club of Wilsonville is an ongoing project. They are an active group in their community and plan many events for variuos causes. They needed help keeping the calendar updated and improving some of the content on their site. </p>
</div>
<img class="projectsite" src="images/website2.png" width="126" height="126" alt="" />
</div>
</main>
</div>
的图像不会出现在你的读者,但我在HTML给你的是什么,我试图完成一个更好的主意。
我还包括了包装信息,因为这是我设置页面以将所有内容居中并将页面左侧和右侧的空白区域分配给它。
你尝试加入' vertical-align:middle;'对div的? – Sablefoste
[如何将所有浏览器的div垂直居中?](http://stackoverflow.com/questions/396145/how-to-vertically-center-a-div-for-all-browsers) –