Centering image horizontally and vertically
Possible Duplicate:
How to make an image center (vertically & horizontally) inside a bigger div
I am trying to make an image gallery on my website, but I cannot center the image inside the div.
The CSS for the div is:
#animation
{
display : none;
position: absolute;
z-index:1;
background : rgba(0,0,0,0.7);
height: 100%;
width: 100%;
border: 0px;
}
And the image id is:
#pictures
{
...
}
One way to do it is a table cell display and vertical align: middle;
Fiddle
margin:auto; add autommatic margin and center the image have a try, but I need more code , could you post it?
margin:auto;
它会通过在div块元素的左侧和右侧添加相等的边距来自动将div对中
链接地址: http://www.djcxy.com/p/75756.html上一篇: 以图片为中心放置在div内的部分
下一篇: 水平和垂直居中图像