user2008567
user2008567

Reputation: 281

Rounded side, not rounded corners

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?

Upvotes: 28

Views: 25911

Answers (4)

Avi E. Koenig
Avi E. Koenig

Reputation: 379

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%;
/****/

Upvotes: 0

Ani Menon
Ani Menon

Reputation: 28199

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>

Upvotes: 2

Margin Right
Margin Right

Reputation: 251

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

Upvotes: 25

Phire
Phire

Reputation: 398

<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/

Upvotes: 5

Related Questions