得到了此問題,我希望圖片在網頁上的網格中佈局,但動畫似乎已受到影響我試過了。例如橫幅可以下車中心或獲得比像大...試圖在不影響動畫的情況下將圖片放置在網頁上的網格中
這裏是我到目前爲止已經有一個小提琴:
所以,我終於拿到了圖像居中,但在一個醜陋的專欄中,恰好排成一條直線。
我想至少有兩個圖像在頂部和兩個在底部與每個圖像之間的空間。有任何想法嗎?
這裏的HTML:
<div id="content">
<div id="main">
<div class="view view-first">
<img src="http://placehold.it/399" />
<div class="mask">
<h2>Item 1</h2>
<br>
<p>A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart.</p>
<br>
<a href="#" class="info">Buy now</a>
</div>
</div>
<div class="view view-first">
<img src="http://placehold.it/399" />
<div class="mask">
<h2>Item 1</h2>
<p>A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart.</p>
<a href="#" class="info">Read More</a>
</div>
</div>
<div class="view view-first">
<img src="http://placehold.it/399" />
<div class="mask">
<h2>Item 1</h2>
<p>A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart.</p>
<a href="#" class="info">more info</a>
</div>
</div>
<div class="view view-first">
<img src="http://placehold.it/399" />
<div class="mask">
<h2>Item 11</h2>
<p>A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart.</p>
<a href="#" class="info">Have a look</a>
</div>
</div>
</div>
</div>
</div>
</div>
以及一些CSS的:
#content {
clear:both;
margin: 0 auto;
width: 1000px;
padding: 35px 0 35px 0;
}
#main {
clear:both;
margin: 0 auto;
width: auto;
text-transform: uppercase;
}
/*----------- grid ----------*/
.view {
width: 399px;
height: 266px;
margin: 0 auto;
overflow: hidden;
position: relative;
text-align: center;
}
.view .mask,.view .content {
width: 399px;
height: 266px;
position: absolute;
overflow: hidden;
top: 0;
left: 0;
}
/*----------- photos ----------*/
.view img {
display: block;
position: relative;
width: 399px;
height:auto;
margin:0 auto;
}
感謝David,#content {text-align:center;}完美無缺。 –