I have a layout like this .
How can I align each div.product_image
to the vertical middle of <li>
items if I don't have fixed height of list item or image and in the same time be sure that images won't overlap each other?
A table may work, but you won't like it. Then JS may help. The "normal" way to do it would need to use min-height & min-width
in <li>
, then using 2 divs. 1st position: absolute;
1px*1px top:50%;left:50%;
, 2nd a relative div left:-Xpx; top:-Ypx; width:2*X; height:2*Y;
left:-Xpx; top:-Ypx; width:2*X; height:2*Y;
(<- that would be static), then just place whatever you want inside.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.