Transparent arrow/triangle indented over an image

后端 未结 4 511
伪装坚强ぢ
伪装坚强ぢ 2020-11-22 02:06

I would like to make a transparent arrow over an image. This triangle should be indented in a semi transparent block and show the background image.

4条回答
  •  鱼传尺愫
    2020-11-22 02:37

    Simple Approach

    • Use pseudo element with box-shadow and transform: rotate();

    • Add overflow: hidden; to main div.

    Snippet :

    body {
      margin: 0;
      padding: 0;
      background: url(http://i.imgur.com/EinPKO3.jpg);
      background-size: cover;
    }
    div {
      height: 100px;
      width: 100%;
      position: absolute;
      bottom: 0;
      overflow: hidden;
    }
    div:before {
      position: absolute;
      top: -50px;
      left: calc(50% - 35px);
      content: "";
      height: 50px;
      width: 50px;
      background: transparent;
      -webkit-transform-origin: 0% 100%;
      -moz-transform-origin: 0% 100%;
      -ms-transform-origin: 0% 100%;
      transform-origin: 0% 100%;
      -webkit-transform: rotate(45deg);
      -moz-transform: rotate(45deg);
      -ms-transform: rotate(45deg);
      transform: rotate(45deg);
      box-shadow: 0 0 0 5000px rgba(0, 0, 0, 0.6);
    }

提交回复
热议问题