我有一個div標籤內的圖像鏈接列表。圖像的大小是動態設置的,因此高度固定爲父div寬度的25%,寬度爲自動。我已將float:left屬性設置爲具有網格樣式的圖像,但現在我想將圖像集中在div中。下面一段代碼:如何對齊<a><img></a>標籤withina div
<div>
<a title="gallery" href="images/silvia.b&w.jpg" data-gallery="">
<img src="thumbnails/silvia.b&w.jpg_New.jpg" style="height: 162.55625px;">
</a>
<a title="gallery" href="images/silvia 165.jpg" data-gallery="">
<img src="thumbnails/silvia 165.jpg_New.jpg" style="height: 162.55625px;">
</a>
...other images
</div>
和CSS:
#text a img{
position:relative;
margin:0.5%;
float: left;
border: 1px solid #999;
padding: 0.5%;
background: #000;
-webkit-filter: grayscale(100%);
-webkit-transition: all 0.9s ease-in-out;
-moz-transition: all 0.9s ease-in-out;
-o-transition: all 0.9s ease-in-out;
-ms-transition: all 0.9s ease-in-out;
transition: all 0.9s ease-in-out;
}
#text a img:hover {
-webkit-filter: none;
-webkit-transform: scale(1.85,1.85);
-moz-transform: scale(1.85,1.85);
-o-transform: scale(1.85,1.85);
-ms-transform: scale(1.85,1.85);
transform: scale(1.85,1.85);
z-index:100;
}
我怎樣才能居中的圖像?
謝謝,這是解決方案! – user3098549