Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS display:table-cell loses margin property

Tags:

css

I have a css class which works perfectly:

.img_holder { width:126px; height:126px; border:1px solid #ccc; overflow:hidden; margin:12px; }

However, when I try to center the image in the div by adding display:table-cell and vertical-align properties, the margin stops working and the div goes top left of its parent... Is this a known effect?

new class which margin fails:

.img_holder { width:126px; height:126px; border:1px solid #ccc; overflow:hidden; margin:12px; display:table-cell; vertical-align:middle; }
like image 905
StudioTime Avatar asked Sep 19 '26 10:09

StudioTime


1 Answers

To get spacing between the cells you might want to use border-spacing:20px;

like image 109
Kosal Avatar answered Sep 21 '26 02:09

Kosal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!