简体   繁体   English

如何获得边界半径以在顶部和底部的角上产生椭圆半径

[英]How to get border-radius to produce an elliptical radius up top and square corners at the bottom

I'd like a CSS div with an arched top and a square (or slightly rounded corners) bottom. 我想要一个CSS div,其顶部为拱形,底部为正方形(或稍圆的角)。

Here's my CSS: 这是我的CSS:

  #oval {
    width: 200px;
    height: 500px;
    background: red;
    border-radius: 80px/20px 5px;
  }

I also tried 80px/20px 80px/20px 5px 5px with no luck, and a bunch of other combinations. 我也尝试了80px/20px 80px/20px 5px 5px ,但没有运气,还有很多其他组合。 I've been testing in Firefox. 我一直在Firefox中进行测试。

Any help would rock! 任何帮助都会动摇!

您可以尝试以下方法:

border-radius: 80px 80px 5px 5px / 20px 20px 5px 5px;

Try building out each corner separately like this 尝试像这样分别构建每个角

  .oval {
    width: 200px;
    height: 500px;
    background: red;

border-top-left-radius:200px;
border-top-right-radius:200px;
border-bottom-right-radius:0;
border-bottom-left-radius:0;

    //border-radius: 80px/20px 5px;
  }

Okay, here's the rule: border-radius: 85% 85% 5px 5px / 15% 15% 5px 5px; 好的,这是规则: border-radius: 85% 85% 5px 5px / 15% 15% 5px 5px;

Apparently, you specify all the horizontal radii for four corners, then all the vertical radii 显然,您指定了四个角的所有水平半径,然后指定了所有垂直半径

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM