gpt4 book ai didi

css - 将 CSS 生成的三 Angular 形拆分为 2 个水平不同的相同颜色

转载 作者:行者123 更新时间:2023-12-02 20:56:27 24 4
gpt4 key购买 nike

正如您应该能够通过此 fiddle 上的代码看到的那样以及下面,我希望能够将第二个 div 顶部显示的 CSS 生成的三 Angular 形水平均匀分割为橙色绿色 使用的颜色。目前它仅以一种形式显示(橙色)。

我不知道该怎么做。

HTML:

<div class="top">
<div class="triangle-down"></div>
</div>
<div class="bottom"></div>

CSS:

.top
{
background: -moz-linear-gradient(left, #FDC57B 0%, #FDC57B 50%, #85D782 50%, #85D782 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, right top, color-stop(0%,#FDC57B), color-stop(50%,#FDC57B), color-stop(50%,#85D782), color-stop(100%,#85D782)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(left, #FDC57B 0%,#FDC57B 50%,#85D782 50%,#85D782 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, #FDC57B 0%,#FDC57B 50%,#85D782 50%,#85D782 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, #FDC57B 0%,#FDC57B 50%,#85D782 50%,#85D782 100%); /* IE10+ */
background: linear-gradient(to right, #FDC57B 0%,#FDC57B 50%,#85D782 50%,#85D782 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#FDC57B', endColorstr='#85D782',GradientType=1 ); /* IE6-9 */
height: 100px;
position: relative;
}

.bottom
{
background: pink;
height: 100px;
}
.triangle-down{
width: 3%;
height: 0;
padding-left:3%;
padding-top: 2%;
overflow: hidden;
position: absolute;
left:0;right:0;
margin:auto;
top: 100px;
z-index:1;
}
.triangle-down:before {
content: '';
display: block;
width: 0;
height: 0;
margin-left:-50px;
margin-top:-33px;

border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-top: 33px solid #FDC57B;
}

最佳答案

两个伪元素直 Angular 三 Angular 形怎么样?

HTML:

<div class="triangle"></div>

CSS:

/* this container is used to position the left and right 
pseudo-element triangles */

.triangle {
position: absolute;
width: 40px;
height: 40px;
left: 50%;
top: 100px;
margin-left: -20px;
}
.triangle:before {
content: " ";
position: absolute;
left: 50%;
top: 0px;
margin-left: -20px;
width: 0px;
height: 0px;
border-style: solid;
border-width: 0 20px 20px 0;
border-color: transparent #FDC57B transparent transparent;
}
.triangle:after {
content: " ";
position: absolute;
left: 50%;
top: 0px;
width: 0px;
height: 0px;
border-style: solid;
border-width: 20px 20px 0 0;
border-color: #85D782 transparent transparent transparent;
}

Jsfiddle:http://jsfiddle.net/vNRHv/18/

关于css - 将 CSS 生成的三 Angular 形拆分为 2 个水平不同的相同颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21299810/

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