Take a look at the following HTML and CSS.
.box {
border-radius: 15px;
border: #333 solid 3px;
background: #333;
}
<div class="box">Hello world</div>
It produces this in Firefox:
As you can see, the border and the background of the div leaves a tiny gap which is visible. I need the border because of a hover state with a different background-color.
How can I overcome this?
If there are contents within the div that has the curved corners, you have to set overflow: hidden because otherwise the child div's overflow can give the impression that the border-radius isn't working.
CSS Syntax Note: The four values for each radius are given in the order top-left, top-right, bottom-right, bottom-left. If bottom-left is omitted it is the same as top-right. If bottom-right is omitted it is the same as top-left. If top-right is omitted it is the same as top-left.
The border-radius CSS property rounds the corners of an element's outer border edge. You can set a single radius to make circular corners, or two radii to make elliptical corners.
This is most likely a bug in Firefox. You could do a simple trick to solve this problem: (it's not the best solution, I know, but the problem seems to be serious)
markup: a fake border through a 'wrapper' div
<div class="wrapper">
<div class="box">Hello world</div>
</div>
css: padding does the trick
.wrapper {
border-radius: 15px;
background: #333;
padding:3px; /*simulating border*/
}
.box {
border-radius: 15px;
background: #333;
}
http://jsfiddle.net/steweb/peYRf/
OR a more elegant way to solve the problems (without add another div) could be adding a shadow on the box of the same background-color to 'fill' that white horrible stuff i.e.
.box {
border:3px solid #333;
border-radius: 15px;
background: #333;
-moz-box-shadow:0px 0px 1px #333; /* just on ffox */
}
http://jsfiddle.net/steweb/Sy2rr/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With