Home > Back-end >  How to remove calc from conic-gradient code
How to remove calc from conic-gradient code

Time:11-18

How would this gradient code be written without calc?

That is all I am trying to figure out how to do. 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>
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

CodePudding user response:

I don't know why are you insisting on removing calc(). You can make your code more lengthy by using 2 gradients if you are afraid of calc() but better learn something new:

.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>
<iframe name="sif2" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

  • Related