Div with double arrow on top and bottom

后端 未结 1 1992
一整个雨季
一整个雨季 2021-01-05 21:25

I\'m not an expert with CSS and I\'m gonna be struggled in order to achieve the following shape for my div:

And then I would like to insert text in the cent

相关标签:
1条回答
  • 2021-01-05 21:34

    Taken from this website here is the chevron shape you desire:

    #chevron {
      position: relative;
      text-align: center;
      padding: 12px;
      margin-bottom: 6px;
      height: 60px;
      width: 200px;
    }
    #chevron:before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      height: 100%;
      width: 51%;
      background: red;
      -webkit-transform: skew(0deg, 6deg);
      -moz-transform: skew(0deg, 6deg);
      -ms-transform: skew(0deg, 6deg);
      -o-transform: skew(0deg, 6deg);
      transform: skew(0deg, 6deg);
    }
    #chevron:after {
      content: '';
      position: absolute;
      top: 0;
      right: 0;
      height: 100%;
      width: 50%;
      background: red;
      -webkit-transform: skew(0deg, -6deg);
      -moz-transform: skew(0deg, -6deg);
      -ms-transform: skew(0deg, -6deg);
      -o-transform: skew(0deg, -6deg);
      transform: skew(0deg, -6deg);
    }
    p{
      position: relative;
      z-index: 1;
    }
    <div id="chevron"><p>Hello</p></div>

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