March 5, 2012
Padding Between "display:table-cell"
Question by user1152440
Is there a way to place padding or a transparent border around the “cells” when one does display:table-cell
? I would like the background to show up through this space, so I can’t just set the border to white, and border-color:transparent
doesn’t work for me for some reason. I’ve checked w3schools and similar sites but I haven’t been able to find this particular trait.
From user Praveen Vijayan: http://jsfiddle.net/geymU/
Answer by Starx
Use border-spacing: 10px
on the parent container.
In your case
#nav ul{
display:table;
width:100%;
border-spacing: 10px;
}
You can also give top/bottom and left/right separately like border-spacing: 10px 20px;