gpt4 book ai didi

html - 两种色调风格背景

转载 作者:行者123 更新时间:2023-12-05 08:45:25 25 4
gpt4 key购买 nike

我只需要像这样设置双色调背景的样式。

我尝试并成功地使用了线性渐变

背景:线性渐变(172deg,#ECB034 50%,#BE883C 50%);

但是调整网页大小时出现问题。它只是没有很好地对齐它的 Angular 落。表现得很奇怪。像这样

enter image description here

有什么办法可以做到这一点吗?

.cta{
padding: 60px 0;
background: linear-gradient(172deg, #ECB034 50%, #BE883C 50%);
text-align:center;
}

.cta h3{
font-size: 58px;
margin-bottom: 30px;
font-weight: 700;
}

.cta a{
padding: 16px 49px;
border: 2px solid #000;
color: inherit;
font-size: 20px;
text-transform: uppercase;
display: inline-block;
font-weight: 500;
}
    <div class="cta text-center">
<div class="container">
<h3>Let’s talk about your project.</h3>
<a href="">Get Started ></a>
</div>
</div>

enter image description here

最佳答案

这是一个非常简单的 SVG 修复(正如我在评论中提到的),您只需将 preserveAspectRatio="none" 添加到 SVG 标记并通过 URL 编码器运行它。 This one甚至会为您生成 CSS,这非常好。

.cta{
padding: 60px 0;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='100%25' width='100%25' preserveAspectRatio='none' viewBox='0 0 10 10'%3E%3Crect width='10' height='10' fill='%23ECB034' /%3E%3Cpath d='m0 10 h10 v-10' fill='%23BE883C' /%3E%3C/svg%3E");
text-align:center;
}

.cta h3{
font-size: 58px;
margin-bottom: 30px;
font-weight: 700;
}

.cta a{
padding: 16px 49px;
border: 2px solid #000;
color: inherit;
font-size: 20px;
text-transform: uppercase;
display: inline-block;
font-weight: 500;
}
<div class="cta text-center">
<div class="container">
<h3>Let’s talk about your project.</h3>
<a href="">Get Started ></a>
</div>
</div>

关于html - 两种色调风格背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72947322/

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