Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is this a bug with CSS3: Rounded corners with CSS3 gradient

Tags:

html

css

gradient

I'm running into an issue where the border of an outer div with rounded-corners is getting cut-off by an inner element with a CSS3 gradiet. Is this a bug with CSS3 - if so, I'll happily submit a bug-report.

If not, how do I fix this?

Source & Demo here: http://jsfiddle.net/joshuamcginnis/2aJ8X/

Screenshot:

alt text

like image 874
doremi Avatar asked Jan 13 '11 16:01

doremi


People also ask

Which property gives rounded corners in CSS3?

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.

Can you created rounded corners using CSS3?

With the CSS border-radius property, you can give any element "rounded corners".

What is CSS rounded corners?

CSS3 Rounded corners are used to add special colored corner to body or text by using the border-radius property.A simple syntax of rounded corners is as follows − #rcorners7 { border-radius: 60px/15px; background: #FF0000; padding: 20px; width: 200px; height: 150px; }

Which of the CSS property below will allow you to apply rounded corners?

You can give any element “rounded corners” by applying a border-radius through CSS. You'll only notice if there is a color change involved. For instance, if the element has a background-color or border that is different than the element it's above.


2 Answers

The problem isn't the gradient - give your <h2> element a solid background to see. Instead, you need to round the corners of the <h2> as well as of the wrapping <div>.

Add border-radius: 10px 10px 0 0; and the appropriate vendor-specific versions to the <h2> styling and it all works.

like image 78
Chowlett Avatar answered Oct 13 '22 17:10

Chowlett


overflow:hidden; does not work

but this does:

h2
{
  position:relative;  
  z-index:-1;
....
}
like image 2
Thorgeir Avatar answered Oct 13 '22 18:10

Thorgeir