How do I make corners rounded only on the top part of the border in css?

HtmlCss

Html Problem Overview


In my site I need to make a div have rounded corners only on the top corners. But I don't know how to do this. Can someone help me?

Html Solutions


Solution 1 - Html

Brendan's answer is correct, but to get it to render in more browsers, you should use this:

-moz-border-radius: 0px;
-webkit-border-radius: 3px 3px 0px 0px;
border-radius: 3px 3px 0px 0px; 

Solution 2 - Html

border-top-left-radius: 3px;
border-top-right-radius: 3px;

Solution 3 - Html

The other answers are correct but there is the shorthand solution:

border-radius: 3px 3px 0 0; 

which will round only the top corners and leave the bottom ones alone. The order of the values is clockwise - top left, top right, bottom right, bottom left.

Here's an example: http://jsfiddle.net/9sXWf/

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionaliView Question on Stackoverflow
Solution 1 - HtmlNotJayView Answer on Stackoverflow
Solution 2 - HtmlBrendanView Answer on Stackoverflow
Solution 3 - HtmlSwaderView Answer on Stackoverflow