gpt4 book ai didi

html - 两个背景水平在 div 一个圆形 div

转载 作者:太空宇宙 更新时间:2023-11-04 11:14:27 26 4
gpt4 key购买 nike

我在一个带有边框半径的 div 中制作两个水平背景时遇到了小问题。我希望主 div 是一个圆圈。

我的代码

body{
text-align: center;
}
.split-outer {
position: relative;
display: inline-block;
width: 200px;
height: 200px;
z-index: 2;
background: #014495;
border-radius: 100%;
}
.split-outer::after{
content: "";
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 50%;
z-index: -1;
background: #fff;
border-bottom-right-radius: 200px;
border-bottom-left-radius: 200px;
}

.split-inner{
width: 200px;
height: 200px;
margin: 0 auto;
color: #fff;
text-align: center;
}

span{
display: block;
}

span.split-title{
padding: 30px 0 10px 0;
font-size: 55px;
text-align: center;
line-height: 55px;
}

span.split-content{
padding: 20px 0;
font-size:18px;
color: #014495;
}
<div class="container-fliud">
<div class="jumbotron">
<div class="split-outer">
<div class="split-inner">
<span class="split-title">100</span>
<span class="split-content">Lorem ipsum</span>
<button type="button" class="btn btn-primary btn-sm">Button</button>
</div>
</div>
</div>
</div>

但我有一个小错误,在后元素中我看到第一个 div 的一些蓝色背景线。它看起来像是从半径生成的边界线。但我想要一个干净的白色圆形背景。

Codepen 上一个:http://codepen.io/michal_t/pen/KdoZYz/

最佳答案

border: 2px solid white放入:after

这是CSS代码:

body {
text-align: center;
}
.split-outer {
position: relative;
display: inline-block;
width: 200px;
height: 200px;
z-index: 2;
background: #014495;
border-radius: 100%;
}
.split-outer::after {
content: "";
position: absolute;
left: -2px;
bottom: -1px;
width: 100%;
height: 50%;
z-index: -1;
background: #fff;
border-bottom-right-radius: 200px;
border-bottom-left-radius: 200px;
border: 2px solid white;
}
.split-inner {
width: 200px;
height: 200px;
margin: 0 auto;
color: #fff;
text-align: center;
}
span {
display: block;
}
span.split-title {
padding: 30px 0 10px 0;
font-size: 55px;
text-align: center;
line-height: 55px;
}
span.split-content {
padding: 20px 0;
font-size: 18px;
color: #014495;
}

这里是 fiddle .

关于html - 两个背景水平在 div 一个圆形 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33341658/

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