CSS responsive slanted edge

前端 未结 1 735
迷失自我
迷失自我 2021-01-27 15:42

I\'m creating a basic webpage, but for the footer there is going to be a slanted edge that will run at the bottom of the page. Where I am having issues as you are unable to add

相关标签:
1条回答
  • 2021-01-27 16:11

    This should work for you. Again, I've used a pseudo element in order to alter the color, but the general consensus is the same. Both the linked question and this use overflow:hidden on the parent and hence won't scroll. As for rotating, since I've used a pseudo element, this should not be an issue:

    .wrap {
      height: 500px;
      width: 100%;
      display: inline-block;
      position: relative;
      overflow: hidden;
      z-index: 8;
    }
    .wrap:after {
      content: "";
      position: absolute;
      height: 130%;
      width: 100%;
      transform: skewY(-4deg);
      background: tomato;
      top: -50%;
      z-index: -2;
      left: 0;
    }
    .lower {
      position: absolute;
      bottom: 15%;
      right: 0;
    }
    <div class="wrap">
      Hello, World!
      <div class="lower">Wanted text here?</div>
    </div>

    0 讨论(0)
提交回复
热议问题