我正在尝试制作2个背景,如下图所示。我正在尝试处理线性渐变和边界半径,但是我只得到90º边界,并且不知道如何更改边界。enter image description here 这是代码
background-image: linear-gradient(left, #e3e3e3, #e3e3e3 30%, transparent 50%, transparent 100%), radial-gradient(circle at top left, #f00,#e3e3e3);
background-image: -webkit-linear-gradient(left, #e3e3e3, #e3e3e3 30%, transparent 30%, transparent 100%);
border-top-right-radius: 36px;
border-bottom-right-radius: 36px;
答案 0 :(得分:1)
您可以这样做:
.box {
padding:20px;
display:inline-block;
font-size:30px;
background:
linear-gradient(blue,blue) left/100px 100% no-repeat,
radial-gradient(circle at left,blue 44%,transparent 45%) 100px 0/74px 74px no-repeat;
}
<div class="box">
Some content here
</div>
您还可以引入CSS变量以进行更多控制:
.box {
padding:20px;
display:inline-block;
font-size:30px;
background:
linear-gradient(blue,blue) left/var(--p,50px) 100% no-repeat,
radial-gradient(circle at left,blue 44%,transparent 45%) var(--p,50px) 0/74px 74px no-repeat;
}
<div class="box">
Some content here
</div>
<div class="box" style="--p:20px">
Some content here
</div>
<div class="box" style="--p:150px">
Some content here
</div>