如何从圆锥梯度代码中删除计算



如果没有calc,该如何编写梯度代码?

这就是我想知道该怎么做的全部。https://jsfiddle.net/gwrcep3q/

.exitnew {
-webkit-appearance: none;
appearance: none;
box-sizing: border-box;
margin: 0;
padding: 0;
width: 48px;
height: 48px;
cursor: pointer;

--b: 7px;
--c: green 90deg, blue 0;
background: conic-gradient(from 90deg at var(--b) var(--b), var(--c)) calc(100% + var(--b)/2) calc(100% + var(--b)/2)/ calc(50% + var(--b)) calc(50% + var(--b));
border: 5px solid red;
border-radius: 50%;
transform: rotate(45deg);
<button class="exitnew" type="button" aria-label="Close"></button>

我不知道你为什么坚持删除calc()。如果你害怕calc(),但最好学习一些新的东西,你可以使用2个梯度来增加代码的长度:

.exitnew {
-webkit-appearance: none;
appearance: none;
box-sizing: border-box;
margin: 0;
padding: 0;
width: 48px;
height: 48px;
cursor: pointer;
background:
linear-gradient(green 0 0),
linear-gradient(green 0 0)
blue;
background-size:7px 100%,100% 7px;
background-position:center;
background-repeat:no-repeat;
border: 5px solid red;
border-radius: 50%;
transform: rotate(45deg);
<button class="exitnew" type="button" aria-label="Close"></button>

最新更新