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;

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!