-3

Is there any simple way using CSS to make this shape? shape

Nenad Vracar
  • 118,580
  • 15
  • 151
  • 176
Lukáš Unzeitig
  • 439
  • 8
  • 23

2 Answers2

0

Yes it can be done. see the below code.

.shape {
    width: 200px;
    height: 100px;
    background: #000;
    margin: 20px 150px;
    position: relative;
}

.shape:after {
        content: '';
    line-height: 0;
    font-size: 0;
    width: 0;
    height: 0;
    border-top: 50px solid #000000;
    border-bottom: 50px solid #fff;
    border-left: 50px solid #000000;
    border-right: 50px solid #fff;
    position: absolute;
    top: 0;
    right: -99px;
}

.shape:before {
        content: '';
    line-height: 0;
    font-size: 0;
    width: 0;
    height: 0;
    border-top: 50px solid #000000;
    border-bottom: 50px solid #fff;
    border-left: 50px solid #fff;
    border-right: 50px solid #000000;
    position: absolute;
    top: 0;
    left: -99px;
}
<div class="shape"></div>
JeetDaloneboy
  • 399
  • 2
  • 16
0

You can use rotateX() and perspective() to create shape like this.

.shape {
  width: 250px;
  height: 70px;
  border: 2px solid black;
  border-top: 1px solid black;
  margin: 50px;
  transform: perspective(10px) rotateX(-2deg);
}
<div class="shape"></div>
Nenad Vracar
  • 118,580
  • 15
  • 151
  • 176