gpt4 book ai didi

html - 我怎样才能用CSS制作对 Angular 线

转载 作者:太空宇宙 更新时间:2023-11-03 21:05:18 25 4
gpt4 key购买 nike

我正在尝试使用 CSS 创建一条对 Angular 线,如下图所示,但我不知道该怎么做。 screen

你能指导我怎么做吗?

.container {
position: relative;
background: #632878;
background: -moz-linear-gradient(-45deg, #632878 9%, #862453 56%, #a83a39 100%);
background: -webkit-linear-gradient(-45deg, #632878 9%, #862453 56%, #a83a39 100%);
background: linear-gradient(135deg, #632878 9%, #862453 56%, #a83a39 100%);
background-repeat: repeat;
width: 200%;
height: 100vh;
background-attachment: fixed;
overflow: hidden;
}

.container:before {
content: '';
position: absolute;
left: 1%;
width: 20%;
height: 160%;
background-color: rgb(255, 255, 255);
/* fallback */
background-color: rgba(255, 255, 255, 0.5);
top: 0;
-webkit-transform: rotate(55deg);
-moz-transform: rotate(55deg);
transform: rotate(55deg);
}
<div class="container">
<!-- Content... -->
</div>

最佳答案

可以考虑多背景。这是一个例子:

.container {
margin: 0;
background:
linear-gradient(to top right, transparent 49.5%, rgba(255, 255, 255, 0.5) 50%) 50% calc(50% + 60px/2 + 80px/2)/100% 80px,
linear-gradient(to bottom right,transparent 49.5%, rgba(255, 255, 255, 0.5) 50%) 50% calc(50% - 60px/2 - 120px/2)/100% 120px,
linear-gradient(rgba(255, 255, 255, 0.5),rgba(255, 255, 255, 0.5)) center/100% 60px,

linear-gradient(135deg, #632878 9%, #862453 56%, #a83a39 100%);
background-repeat: no-repeat;
height: 400px;
width:400px;
overflow: hidden;
}
<div class="container">

</div>

或者像下面这样的剪辑路径:

.container {
margin: 0;
background:
linear-gradient(135deg, #632878 9%, #862453 56%, #a83a39 100%);
background-repeat: no-repeat;
height: 400px;
width:400px;
position:relative;
}
.container::before {
content:"";
position:absolute;
top:80px;
bottom:50px;
left:0;
right:0;
background:rgba(255, 255, 255, 0.5);
-webkit-clip-path: polygon(0 31%, 100% 0, 100% 100%, 0 75%);
clip-path: polygon(0 31%, 100% 0, 100% 100%, 0 75%);
}
<div class="container">

</div>

另一个旋转和透视的想法:

.container {
margin: 0;
background:
linear-gradient(135deg, #632878 9%, #862453 56%, #a83a39 100%);
background-repeat: no-repeat;
height: 400px;
width:400px;
position:relative;
overflow:hidden;
}
.container::before {
content:"";
position:absolute;
top:140px;
bottom:120px;
left:0;
right:0;
background:rgba(255, 255, 255, 0.5);
transform:perspective(200px) rotateY(-25deg);
transform-origin:left;
}
<div class="container">

</div>

关于html - 我怎样才能用CSS制作对 Angular 线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53965555/

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