CSS에서 요소의 배경을 그라데이션으로 설정할 때 사용되는 기능
- inear-gradient: 한쪽 끝에서 반대쪽 끝까지 직선 방향으로 변하는 그라데이션.
- radial-gradient: 중심에서 외곽으로 퍼지는 원형 또는 타원형 그라데이션.
- conic-gradient: 중심에서 시계 방향으로 회전하며 변하는 원뿔형 그라데이션.
linear-gradient(direction, color-stop1, color-stop2, ...)
to bottom
(기본값)to top
, to left
, to right
, to top left
...background: linear-gradient(to right, red 20%, yellow 50%, blue 80%);
background: linear-gradient(to right, red, green);
radial-gradient(shape size at position, color1, color2, ...)
circle
(원형)과 ellipse
(타원형)를 지정circle
:(기본값)farthest-corner``closest-side
, farthest-side
, closest-corner
등의 키워드를 사용가능farthest-corner
(기본값): 시작점에서 가장 먼 모퉁이까지 그라데이션이 확장closest-side
: 시작점에서 가장 가까운 모서리나 면까지 그라데이션이 확장farthest-side
: 시작점에서 가장 먼 모서리나 면까지 그라데이션이 확장closest-corner
: 시작점에서 가장 가까운 모퉁이까지 그라데이션이 확장center
, top
left
, bottom right
등으로 설정 가능 center
background: radial-gradient(circle, red, blue);
background: radial-gradient(ellipse closest-side, red, blue);
background: radial-gradient(circle farthest-corner at top right, red, blue);
conic-gradient(from angle at position, color-stop1, color-stop2, ...)
center
, top
, left
등으로 지정할 수 있음.background: conic-gradient(red, blue, green);
background: conic-gradient(from 90deg, red, yellow, blue);
background: conic-gradient(red 0%, yellow 25%, green 50%, blue 75%);
background: conic-gradient(at top right, red, yellow, green, blue);