gpt4 book ai didi

html - div 左上角/右下角的斜 Angular

转载 作者:太空宇宙 更新时间:2023-11-03 23:38:19 26 4
gpt4 key购买 nike

Slanted corners on top-left / bottom-right sides of div

我们如何在纯 CSS 中创建这个形状?

最佳答案

你可以像下面这样:

html

<div class="topleft">
<div class="buttomright"></div>
</div>

and the css

div {
height: 300px;
background: silver;
position: relative;
}
.topleft:after {
content:'';
position: absolute;
top: 0;
left: 0;

border-top: 80px solid white;
border-right: 80px solid silver;
width: 0;
}

.buttomright:before {
content:'';
position: absolute;
bottom: 0;
right: 0;
border-bottom: 80px solid white;
border-left: 80px solid silver;
width: 0;
}

请参阅JSFiddle

关于html - div 左上角/右下角的斜 Angular ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23486821/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com