28

I'd like to create a shape like the one displayed below entirely in CSS. As you can tell, it would take a bit more tweaking than simply applying rounded corners...

shape with rounded bottom side

Can it be done?

2
  • 3
    css-tricks.com/examples/ShapesOfCSS Commented Jan 24, 2013 at 18:37
  • It's still nothing more than applying border-radius. Commented Jan 24, 2013 at 19:16

4 Answers 4

25

Here is the jsfiddle: http://jsfiddle.net/swqZL/

CSS for element div with class "figure":

.figure {
height: 400px;
width: 200px;
background-color: black;
border-bottom-left-radius: 100%30px;
border-bottom-right-radius: 100%30px;    
}

Horizontal radius 100%, vertical radius 30px

Sign up to request clarification or add additional context in comments.

2 Comments

It annoys me that this is not symmetrical.
@Petah It is but because it is left-aligned it looks as if it isn't. Here is the centered version: jsfiddle.net/8t76exvo/2
5
<div style="background: black; 
        width: 300px; 
        height: 450px; 
        padding-top: 50px;">
    <div style="width: 200px; 
            height: 400px; 
            background: white; 
            margin: 0 auto;
            border-radius: 0 0 100px 100px / 0 0 25px 25px;
            -moz-border-radius: 0 0 100px 100px / 0 0 25px 25px;
            -webkit-border-radius: 0 0 100px 100px / 0 0 25px 25px;
            ">
    </div>
</div>

Info on selective oval border-radii found here: http://www.sitepoint.com/setting-css3-border-radius-with-slash-syntax/

3 Comments

1. Unprefixed poperty should be last, plus these days the prefixed ones aren't needed anymore. 2. Why inline styles? 3. Why two elements? One would do it. Demo dabblet.com/gist/4626553
1. Good to know! 2. So it can be copied and dropped somewhere without additional mods. 3. I assumed the OP wanted to create the entire image (box with another box inside of it).
1. Remember caniuse.com - damn useful! 2. Still, that could cause more problems than it solves. 3. Valid point.
2

Working Snippet:

.border-radius-example {
  width: 125px;
  height: 175px;
  background: #000;
  margin: 20px;
  float: left;
  padding: 5px;
}

#border-radius-bottom {
  -moz-border-radius-bottomleft: 100%35px;
  -webkit-border-bottom-left-radius: 100%35px;
  border-bottom-left-radius: 100%35px;
  -moz-border-radius-bottomright: 100%35px;
  -webkit-border-bottom-right-radius: 100%35px;
  border-bottom-right-radius: 100%35px;
}
<div class='border-radius-example' id='border-radius-bottom'>

</div>

1 Comment

Oh yes.. I was actually answering another question & saw this one had no selected answer so posted the code.
0

adding to previously answered:

this may add some dynamic value

/****/
border-top-right-radius: 25%40%;
border-top-left-radius: 25%40%;
border-bottom-left-radius:25%40%;
border-bottom-right-radius: 25%40%;
/****/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.