Home > Article > Web Front-end > Can CSS3 Transform Perspective Create Trapezoids?
Question:
In pursuit of emulating the captivating trapezoidal elements found on the Google Mobile Safari homepage, a developer seeks guidance on leveraging CSS3 for their creation.
Answer:
CSS Transform Perspective
Emerging as a robust solution, CSS Transform Perspective empowers developers to manipulate elements in three-dimensional space. By applying a perspective and rotation, we can effortlessly transform a rectangular element into a trapezoid:
.trapezoid { width: 200px; height: 200px; background: red; transform: perspective(10px) rotateX(1deg); margin: 50px; }
HTML:
<div class="trapezoid"></div>
The above is the detailed content of Can CSS3 Transform Perspective Create Trapezoids?. For more information, please follow other related articles on the PHP Chinese website!