transparent shape with arrow in upper corner

后端 未结 2 958
余生分开走
余生分开走 2020-12-06 18:07

Please see the image below.

\"Desired

I want to add an arrow to the top right of a div

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-06 18:38

    Filter: drop-shadow()

    The compatibility is limited

    Yet the effect is pretty cool :P

    .inputcontainer {
      display: inline-block;
      position: relative;
      filter: drop-shadow(0px 0px 5px black);
      -webkit-filter: drop-shadow(0px 0px 1px black);
    }
    .input {
      display: inline-block;
      border: none;
      border-radius: 10px;
      border-top-right-radius: 0px;
      width: 280px;
      height: 50px;
      background-color: white;
      padding-left: 20px;
      font-size: 20px;
    }
    .input:focus {
      outline: none;
    }
    .arrow {
      position: absolute;
      display: inline-block;
      top: 0;
      right: -5px;
      width: 20px;
      height: 20px;
      background-color: white;
      transform: skew(-45deg);
      z-index: -1;
    }

    Box-shadow:

    Here the compatibility is a lot better

    .inputcontainer {
      display: inline-block;
      position: relative;
      filter: drop-shadow(0px 0px 5px black);
    }
    .input {
      display: inline-block;
      border: none;
      border-radius: 10px;
      border-top-right-radius: 0px;
      width: 280px;
      height: 50px;
      background-color: white;
      padding-left: 20px;
      font-size: 20px;
      box-shadow: 0px 0px 0px 2px gray;
    }
    .input:focus {
      outline: none;
    }
    .arrow {
      position: absolute;
      display: inline-block;
      top: 0;
      right: -8px;
      width: 20px;
      height: 20px;
      background-color: white;
      transform: skew(-45deg);
      box-shadow: 2px -2px 0px 0px gray;
    }

提交回复
热议问题