1

I'm confused about how can I transform the corners in one side (top or bottom) only something like below:

Normal:

enter image description here

Transformed:

enter image description here

Can anyone please help me on this? Here, the top corners stay same and the bottom corners are transformed. How can I achieve this?

gacat
  • 116
  • 1
  • 13

2 Answers2

3

You can start with something like this, clean and simple without multiple divs.

#trapezium {
  width: 200px;
  height: 100px;
  margin: 50px;
  transform: perspective(100px) rotateX(-45deg);
  background-color: gray;
}
<div id='trapezium'></div>
Manjuboyz
  • 6,978
  • 3
  • 21
  • 43
1

you can have similar output using perspective and transform: rotateX(-45deg); CSS attribute, here is a working snippet:

.scene {
  position: relative;
  left:100px;
  width: 200px;
  height: 200px;
  
  margin: 40px;
  /* perspective property */
  perspective: 400px;
}

.panel {
  width: 100%;
  height: 100%;
  background: blue;
  transform:  rotateX(-45deg);
}
<div class="scene">
  <div class="panel"></div>
</div>
ROOT
  • 11,363
  • 5
  • 30
  • 45