【发布时间】:2017-06-20 18:31:09
【问题描述】:
【问题讨论】:
-
到目前为止你尝试过什么?你的代码在哪里? stackoverflow.com/help/mcve
-
这么多问题已经问过同样的问题了..请使用谷歌
标签: html css web frontend stylesheet
【问题讨论】:
标签: html css web frontend stylesheet
你试过transform: skewX()
它在一定程度上使物体倾斜。我喜欢在 css 中使用转换,因为我可以按照自己喜欢的方式操作 div,需要一些时间来适应它以及它是如何工作的,但是你应该尝试一下它是否适合你。
以下是有关 Transform 的更多信息:https://www.w3schools.com/cssref/css3_pr_transform.asp
我在这里做了一个例子: https://jsfiddle.net/4r3mqctp/1/
希望这会有所帮助
【讨论】:
这是一个如何实现的示例。
.root {
border: 1px solid gray;
background-color: yellow;
width: 100%;
height: 200px;
position: relative;
overflow: hidden;
}
.slash {
width: 200%;
height: 200%;
background-color: white;
border: 5px solid gray;
transform: rotate(45deg) translateY(100%);
}
<div class="root">
<div class="slash"></div>
</div>
【讨论】: