Facebook gallery/lightbox - centred image while loading
Does Facebook in its gallery put image width and height in database?
Using JavaScript, they can not be sure about image width and height until image fully loads. But on FB, image is been loaded while its displaying and image is开发者_如何学JAVA properly centered horizontally and vertically.
Facebook use display:inline-block
for the image and text-align:center
for parent div to center image in theater images.
Check out their blog post that explained how they did it. It's a nice CSS code but not all CSS. They use JS to set line-height
of one of divs based on window.height
.
精彩评论