How to achieve chamfered CSS Border Corners rather than rounded corners?

前端 未结 8 1216
南方客
南方客 2020-12-01 05:47

With the CSS border-radius property I can have a curvy, rounded border corner at the end.

.boxLeft{
             


        
8条回答
  •  日久生厌
    2020-12-01 06:36

    This is what you need, transparency and everything

    .left,
    .right {
      width: 100px;
      height: 100px;
      float: left;
      position: relative;
      overflow: hidden;
    }
    
    .right::after,
    .left::after {
      content: '';
      width: 200px;
      height: 200px;
      position: absolute;
      -moz-transform: rotate(45deg);
      -webkit-transform: rotate(45deg);
      -o-transform: rotate(45deg);
      -ms-transform: rotate(45deg);
      transform: rotate(45deg);
    }
    
    .right::after {
      background: lightblue;
      left: -40px;
      top: -100px;
    }
    
    .left::after {
      background: lightpink;
      left: -60px;
      top: -100px;
    }

提交回复
热议问题