gpt4 book ai didi

html - 如何使用css3隐藏背景颜色

转载 作者:太空宇宙 更新时间:2023-11-04 08:07:10 25 4
gpt4 key购买 nike

我已经尝试实现黄色背景 '' 但它没有隐藏右侧曲线上的黄色背景?请建议我如何隐藏在曲线背景上溢出的右侧黄色背景。

HTML:

.header {
display: block;
width: 300px;
overflow: hidden;
position: relative;
}

.header-background {
background: #1d637d;
border-radius: 50%;
position: absolute;
top: -50%;
right: 0;
bottom: -50%;
left: -100%;
z-index: 1;
}

.header-content {
position: relative;
z-index: 2;
padding-left: 10px;
padding-right: 40px;
}

.header-content1 {
position: relative;
z-index: 2;
padding-left: 10px;
padding-right: 40px;
background-color: yellow;
width: 100%;
}

.header-content>p {
color: #fff;
}
<div class="header">
<div class="header-background"></div>
<div class="header-content">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
</p>
<div class="header-content1">
<p>Click</p>

</div>
</div>

最佳答案

这可能有帮助

.header {
display: block;
width: 300px;
overflow: hidden;
position: relative;
}

.header-background {
background: #1d637d;
border-radius: 50%;
position: absolute;
top: -50%;
right: 0;
bottom: -50%;
left: -100%;
z-index: 1;
}

.header-content {
position: relative;
z-index: 2;
padding-left: 10px;
padding-right: 40px;
}
.header-content1 {
position: relative;
z-index: 2;
padding-left: 10px;
padding-right: 18px;
background-color: yellow;
width: 100%;
border-radius: 0 0 20px 0;
cursor: pointer;
}

.header-content > p {
color: #fff;
}
<div class="header">
<div class="header-background"></div>
<div class="header-content">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
</p>
<div class="header-content1">
<p>Click</p>

</div>
</div>

关于html - 如何使用css3隐藏背景颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46538619/

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