Rounded side, not rounded corners

此生再无相见时 提交于 2019-11-27 01:19:11

问题


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

Can it be done?


回答1:


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




回答2:


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


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>


来源:https://stackoverflow.com/questions/14508148/rounded-side-not-rounded-corners

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!