CSS 원추형 그래디언트() 함수
예시
세 가지 색상의 원뿔형 그라디언트:
#grad {
background-image: conic-gradient(red, yellow,
green);
}
아래에서 더 많은 "직접 사용해 보기" 예를 살펴보세요.
정의 및 사용
conic-gradient() 함수는 원뿔 그라디언트를 배경 이미지로 설정합니다.
원추형 그라디언트는 중심점을 중심으로 회전된 색상 전환이 있는 그라디언트입니다.
원뿔형 그라디언트를 생성하려면 최소한 두 개의 색상 정지점을 정의해야 합니다.
원뿔 기울기의 예:
버전: | CSS3 |
---|
브라우저 지원
표의 숫자는 기능을 완전히 지원하는 첫 번째 브라우저 버전을 지정합니다.
Function | |||||
---|---|---|---|---|---|
conic-gradient() | 69.0 | 79.0 | 83.0 | 12.1 | 56.0 |
CSS 구문
background-image: conic-gradient([from angle] [at position,] color degree, color degree, ...);
Value | Description |
---|---|
from angle | Optional. The entire conic gradient is rotated by this angle. Default value is 0deg |
at position | Optional. Specifies the gradient center of the conic gradient. Default value is center |
color degree, ..., color degree | Color stops are the colors you want to render smooth transitions among. This value consists of a color value, followed by an optional stop position (a degree between 0 and 360 or a percent between 0% and 100%). |
더 많은 예
예시
5가지 색상의 원뿔형 그라디언트:
#grad {
background-image: conic-gradient(red, yellow, green, blue,
black);
}
예시
세 가지 색상과 각 색상의 차수가 있는 원추형 그라디언트:
#grad {
background-image: conic-gradient(red 45deg, yellow 90deg, green 210deg)
}
예시
border-radius: 50%를 추가하여 원뿔형 그라디언트를 파이처럼 보이게 합니다.
#grad {
background-image: conic-gradient(red, yellow, green, blue,
black);
border-radius: 50%;
}
예시
시작 각도가 있는 원추형 그라디언트:
#grad {
background-image: conic-gradient(from 90deg, red, yellow, green);
border-radius: 50%;
}
예시
at 위치가 있는 원추 기울기:
#grad {
background-image: conic-gradient(at 60% 45%, red, yellow, green);
border-radius: 50%;
}
예시
각도와 위치에서 모두 원뿔형 그라디언트:
#grad {
background-image: conic-gradient(from 90deg at 60% 45%, red, yellow, green);
border-radius: 50%;
}
예시
다른 파이 차트:
#grad {
background-image: conic-gradient(red 0deg, red 90deg, yellow
90deg, yellow 180deg, green 180deg);
border-radius: 50%;
}
관련 페이지
CSS 튜토리얼: CSS 그라디언트