Rounded trapezoid with CSS

后端 未结 5 1102
孤城傲影
孤城傲影 2020-12-11 21:31

I\'m having a slight problem with css. I need a trapezoid div which upper left corner(the one with the angle above 90 degrees) is rounded. I already know that this:

5条回答
  •  无人及你
    2020-12-11 22:02

    Voila:

    css:

    .trapezoid{
        vertical-align: middle;
        background: red;
        padding-left: 200px;
        height: 120px;
        width: 150px;
        position: relative;
        border-top-left-radius: 40px;
        overflow: hidden;
        background-clip: content-box;
    }
    
    .trapezoid:after{
        content: '';
        margin-left: -100px;
        top: 0;
        height: 120px;
        background: red;
        transform: skew(-31deg,0deg);
        -o-transform: skew(-31deg,0deg);
        -ms-transform: skew(-31deg,0deg);
        -moz-transform: skew(-31deg,0deg);
        -webkit-transform: skew(-59deg,0deg);
        position: absolute;
        width: 1000px;
        border-top-left-radius: 40px;
    }
    

    Demo:
    http://jsfiddle.net/n3TLP/24/

提交回复
热议问题