简体   繁体   English

如何使用CSS3转换DIV容器

[英]How to transform DIV-Container with CSS3

I try to transform my div container like the following picture. 我尝试如下图所示变换div容器。

CSS Perspec

Left is a normal div container painted black. 左边是一个普通的漆成黑色的div容器。 On the right is the container i want to have. 右边是我想要的容器。

Do you know how to solve this in css3 ? 您知道如何在CSS3中解决此问题吗? i read something about the "Polygon" attribute in css3, but i also heard that this attribut was removed. 我在css3中阅读了有关“多边形”属性的内容,但我也听说此属性已删除。

edit: when content is in the box it would be screchted - the box is like "falling in the back". 编辑:当内容在框中时,它将被刮掉-框就像“掉在后面”。

I found an article at css-tricks.com regarding this a while back. 不久前,我在css-tricks.com上找到了一篇有关此的文章 This may work: 这可能起作用:

#trapezoid {
    border-bottom: 100px solid red;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    height: 0;
    width: 100px;
}
    #trapezoid { 
 border-bottom: 100px solid black;
 border-left: 50px solid transparent; 
 border-right: 50px solid transparent; 
 height: 0; width: 100px; }

Check here for more shapes and tricks 在这里查看更多形状和技巧

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM