我有一个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