0

没有这个梯度代码怎么写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>

4

1 回答 1

0

我不知道你为什么坚持删除calc(). 如果你害怕,你可以通过使用 2 个渐变来使你的代码更冗长,calc()但最好学习一些新的东西:

.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>

于 2021-11-17T10:02:11.973 回答