Border radius and backgrounds
So this is a fairly common question.
If you have an element that has a
The common answer is add
Until you need to do things that
The other alternative is to add
In my case I need to absolute position something so
What other options are there?
A very simple example below.
https://jsfiddle.net/wcbjo9uf/
If you have an element that has a
border-radius and then a child within that which has a background this will not overflow the parent's border radius. As the image shows, there's no curves on the top corners.The common answer is add
overflow: hidden to the parent. And that works.Until you need to do things that
overflow: hidden will screw up. For example you need to absolute position an element outside of the parent's space, or maybe you need scrollbars.The other alternative is to add
border-radius to the child. This will also work, perhaps with some bleeding with you can tweak out.In my case I need to absolute position something so
overflow: hidden is a no-go, and additionally as the content is dynamic I can't be sure if the child element wit a background will be at the parent element's edge or not - thus border radius can't be applied to the child.What other options are there?
A very simple example below.
https://jsfiddle.net/wcbjo9uf/

Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle code editor.
