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?

web-tiki
  • 99,765
  • 32
  • 217
  • 249
user2008567
  • 281
  • 1
  • 3
  • 3

4 Answers4

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

Margin Right
  • 251
  • 2
  • 3
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/

Phire
  • 398
  • 2
  • 7
  • 2
    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 http://dabblet.com/gist/4626553 – Ana Jan 24 '13 at 19:06
  • 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). – Phire Jan 24 '13 at 19:09
  • 1
    1. Remember http://caniuse.com/ - damn useful! 2. Still, that could cause more problems than it solves. 3. Valid point. – Ana Jan 24 '13 at 19:13
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>
Ani Menon
  • 27,209
  • 16
  • 105
  • 126
  • 1
    Oh yes.. I was actually answering another question & saw this one had no selected answer so posted the code. – Ani Menon May 07 '16 at 09:05
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%;
/****/
Avi E. Koenig
  • 360
  • 5
  • 13