gpt4 book ai didi

css - 复杂的 CSS 形状

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

我需要一些 CSS 帮助。这很难解释,但看一下代码片段,我需要黑色部分而不需要红色。

我使用了两个元素,但应该可以使用一个......

.q-rounder {
background: #222;
width: 15px;
height: 15px;
}

.quarter-circle {
width: 15px;
height: 15px;
background: red;
border-radius: 100px 0 0 0;
-moz-border-radius: 100px 0 0 0;
-webkit-border-radius: 100px 0 0 0;
}
<div class="q-rounder">
<div class="quarter-circle"></div>
</div>

( fiddle )

最佳答案

使用径向渐变作为背景

.q-rounder {
background:
radial-gradient(farthest-side at bottom right,transparent 94%, #222);
width: 15px;
height: 15px;
}
<div class="q-rounder">
</div>

另一种带有 at 的语法,以获得更好的支持 ( safari doesn't support the at )

.q-rounder {
background:
radial-gradient(farthest-side,transparent 94%, #222) top left/200% 200%;
width: 15px;
height: 15px;
}
<div class="q-rounder">
</div>

关于css - 复杂的 CSS 形状,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54953319/

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