Home  >  Article  >  Web Front-end  >  How to realize a trapezoid in css3

How to realize a trapezoid in css3

WBOY
WBOYOriginal
2021-12-02 17:40:392654browse

In css, you can use the border and "border-top" attributes to achieve a trapezoidal effect. You only need to add the "border: thickness value solid transparent; border-top: trapezoid height solid trapezoid color;" style to the element, that is Can.

How to realize a trapezoid in css3

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

How to implement a trapezoid in css3

In css, if we want Create a trapezoidal pattern effect, how to achieve it? The following example explains how to achieve a trapezoidal pattern effect in CSS3.

The example is as follows:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style type="text/css">
div{
    border:25px solid transparent;
    border-top: 25px solid red;
  height: 200px;
  width: 100px;
}
</style>
</head>
<body>
<div></div>
</body>
</html>

Output result:

How to realize a trapezoid in css3

(Learning video sharing: css video tutorial)

The above is the detailed content of How to realize a trapezoid in css3. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn