Cut Corners using CSS

后端 未结 15 1178
悲&欢浪女
悲&欢浪女 2020-11-22 03:34

I\'m looking to \"cut\" the top left corner of a div, like if you had folded the corner of a page down.

I\'d like to do it in pure CSS, are there any methods?

15条回答
  •  遇见更好的自我
    2020-11-22 03:58

    Another one solution: html:

    Hello world!

    css:

    .background {
      position: relative;
      width: 50px;
      height: 50px;
      border-right: 150px solid lightgreen;
      border-bottom: 150px solid lightgreen;
      border-radius: 10px;
    }
    .background::before {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      width: 0;
      height: 0;
      border: 25px solid lightgreen;
      border-top-color: transparent;
      border-left-color: transparent;
    }
    .container {
      position: absolute;
      padding-left: 25px;
      padding-top: 25px;
      font-size: 38px;
      font-weight: bolder;
    }
    

    https://codepen.io/eggofevil/pen/KYaMjV

提交回复
热议问题