Cum de a crea un triunghi dreptunghic gradient

0

Problema

Eu sunt încercarea de a crea acest lucru ca pe un gradient. https://jsfiddle.net/ojscg6fn/

enter image description here

Am un cerc de aici, cum pot crea un triunghi dreptunghic gradient pentru a plasa în mijlocul cerc?

https://jsfiddle.net/79mjuhb2/

enter image description here

.play {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  width: 90px;
  height: 90px;
  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: 9px solid red;
  border-radius: 50%;
  transform: rotate(45deg);
  }
<button class="play" type="button" aria-label="Close"></button>

css gradient linear-gradients
2021-11-17 10:35:42
2

Cel mai bun răspuns

0

Utilizați un conic-gradient

.play {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  width: 90px;
  height: 90px;
  cursor: pointer;
  background: conic-gradient(from -135deg at right,red 90deg,#0000 0) 55% 50%/22px 44px no-repeat;
  border: 9px solid red;
  border-radius: 50%;
  }
<button class="play" type="button" aria-label="Close"></button>

2021-11-17 10:57:14

Cum ar fi fost scris folosind un gradient liniar în loc de conice? Puteți oferi un exemplu de liniar, de asemenea,?
-1

HTML

<button class="play" type="button" aria-label="Close">
  <div id="triangle-right"></div>
</button>

CSS

.play {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  width: 90px;
  height: 90px;
  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: 9px solid red;
  border-radius: 50%;
  transform: rotate(0deg);
}
#triangle-right {
  width: 0;
  height: 0;
  border-top: 20px solid transparent;
  border-left: 20px solid red;
  border-bottom: 20px solid transparent;
  margin-left: 30px;
}

Aici este demo de lucru https://jsfiddle.net/rgn8wsbj/

2021-11-17 10:53:06

În alte limbi

Această pagină este în alte limbi

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................