Consider a div
with the border-radius
, border
, and background-color
CSS attributes applied:
<div style="background-color:#EEEEEE; border-radius:10px; border: 1px black solid;">
Blah
</div>
Now consider a similar layout but with the background-color
specified in an inner-div:
<div style="border-radius:10px; border: 1px black solid;">
<div style="background-color:#EEEEEE;">
Blah
</div>
</div>
I'm dismayed by the fact that the background-color
of the inner <div>
is obscuring the border of the outer <div>
.
This is a simplified sample of the problem. In reality, I'm using a <table>
as the inner element with alternating row colors. And I'm using a <div>
as the outer element since border-radius
does not seem to work on the <table>
element. Here's a jsfiddle of a sample of this problem.
Does anyone have a suggestion for a solution?
You can fix this by applying
overflow: hidden;
to the element with the border. A much cleaner way I think.You could add border-radius to the child element too.
Add these CSS rules:
See updated fiddle.
Does a table have to be used? Here's an example using DIV's: http://jsfiddle.net/6KwGy/1/
HTML:
CSS:
Add some padding, or do the background color on the outer element
Try
overflow:hidden
in the outerdiv
: