CSS 방사형 그래디언트() 함수
예시
균일한 간격의 색상이 있는 방사형 그라디언트는 다음을 중지합니다.
#grad {
background-image: radial-gradient(red, green, blue);
}
아래에서 더 많은 "직접 사용해 보기" 예를 살펴보세요.
정의 및 사용
방사형 그래디언트() 함수는 방사형 그래디언트를 배경 이미지로 설정합니다.
방사형 그래디언트는 중심으로 정의됩니다.
방사형 그래디언트를 생성하려면 최소한 두 개의 색상 정지점을 정의해야 합니다.
방사형 그라디언트의 예:
버전: | CSS3 |
---|
브라우저 지원
표의 숫자는 기능을 완전히 지원하는 첫 번째 브라우저 버전을 지정합니다.
-webkit-, -moz- 또는 -o- 뒤에 오는 숫자는 접두사와 함께 작동한 첫 번째 버전을 지정합니다.
Function | |||||
---|---|---|---|---|---|
radial-gradient() | 26.0 10.0 -webkit- |
10.0 | 16.0 3.6 -moz- |
6.1 5.1 -webkit- |
12.1 11.6 -o- |
CSS 구문
background-image: radial-gradient(shape size at position, start-color, ..., last-color);
Value | Description |
---|---|
shape | Defines the shape of the gradient. Possible values:
|
size | Defines the size of the gradient. Possible values:
|
position | Defines the position of the gradient. Default is "center" |
start-color, ..., last-color | 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 percentage between 0% and 100% or a length along the gradient axis). |
더 많은 예
예시
색상 간격이 다른 방사형 그라디언트는 다음을 중지합니다.
#grad {
background-image: radial-gradient(red 5%, green 15%, blue 60%);
}
예시
원 모양의 방사형 그래디언트:
#grad {
background-image: radial-gradient(circle, red, yellow, green);
}
예시
다양한 크기의 키워드가 있는 방사형 그래디언트:
#grad1 {
background-image: radial-gradient(closest-side at 60% 55%, blue, green, yellow, black);
}
#grad2 {
background-image: radial-gradient(farthest-side at 60% 55%, blue, green, yellow, black);
}
관련 페이지
CSS 튜토리얼: CSS 그라디언트