one sided skew with css

后端 未结 2 398
小鲜肉
小鲜肉 2020-12-22 12:40

I want to create a one sided skew, but failed to do so. here is what I\'ve tried so far:

2条回答
  •  忘掉有多难
    2020-12-22 13:26

    Add overflow:hidden to your .bg-style1 rule and transformX(-40%) to the transform: in .bg-style1:after

    .bg-style1 {
      padding-top: ;
      background: #ccc;
      position: relative;
      display: block;
      z-index: 2;
      overflow: hidden;
    }
    .bg-style1:after {
      content: " ";
      position: absolute;
      display: block;
      width: 30%;
      height: 100%;
      left: 0;
      top: 0;
      z-index: -1;
      background: #333333;
      -ms-transform: skew(-30deg, 0deg);
      -webkit-transform: skew(-30deg, 0deg);
      transform: skew(-30deg, 0deg) translateX(-50%);
    }

    What is lorem ipsum

    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

提交回复
热议问题