CSS 참조

CSS 참조 CSS 브라우저 지원 CSS 선택기 CSS 함수 CSS 참조 청각 CSS 웹 안전 글꼴 CSS 폴백 글꼴 CSS 애니메이션 가능 CSS 단위 CSS PX-EM 변환기 CSS 색상 CSS 색상 값 CSS 기본값 CSS 엔터티

CSS Properties

align-content align-items align-self all animation animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function backface-visibility background background-attachment background-blend-mode background-clip background-color background-image background-origin background-position background-repeat background-size border border-bottom border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-collapse border-color border-image border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-left border-left-color border-left-style border-left-width border-radius border-right border-right-color border-right-style border-right-width border-spacing border-style border-top border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width border-width bottom box-decoration-break box-shadow box-sizing break-after break-before break-inside caption-side caret-color @charset clear clip clip-path color column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width columns content counter-increment counter-reset cursor direction display empty-cells filter flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap float font @font-face font-family font-feature-settings font-kerning font-size font-size-adjust font-stretch font-style font-variant font-variant-caps font-weight gap grid grid-area grid-auto-columns grid-auto-flow grid-auto-rows grid-column grid-column-end grid-column-gap grid-column-start grid-gap grid-row grid-row-end grid-row-gap grid-row-start grid-template grid-template-areas grid-template-columns grid-template-rows hanging-punctuation height hyphens image-rendering @import isolation justify-content @keyframes left letter-spacing line-height list-style list-style-image list-style-position list-style-type margin margin-bottom margin-left margin-right margin-top mask-image mask-mode mask-origin mask-position mask-repeat mask-size max-height max-width @media min-height min-width mix-blend-mode object-fit object-position opacity order orphans outline outline-color outline-offset outline-style outline-width overflow overflow-wrap overflow-x overflow-y padding padding-bottom padding-left padding-right padding-top page-break-after page-break-before page-break-inside perspective perspective-origin pointer-events position quotes resize right row-gap scroll-behavior tab-size table-layout text-align text-align-last text-decoration text-decoration-color text-decoration-line text-decoration-style text-indent text-justify text-overflow text-shadow text-transform top transform transform-origin transform-style transition transition-delay transition-duration transition-property transition-timing-function unicode-bidi user-select vertical-align visibility white-space widows width word-break word-spacing word-wrap writing-mode z-index



CSS linear-gradient() 함수

❮ CSS 함수 참조

예시

이 선형 그라데이션은 상단에서 시작됩니다. 빨간색으로 시작하여 노란색으로 전환된 다음 파란색으로 바뀝니다.

#grad {
  background-image: linear-gradient(red, yellow, blue);
}

아래에서 더 많은 "직접 사용해 보기" 예를 살펴보세요.


정의 및 사용

linear-gradient() 함수는 선형 그래디언트를 배경 이미지로 설정합니다.

선형 그래디언트를 생성하려면 최소한 두 개의 색상 정지점을 정의해야 합니다. 색상 정지점은 부드러운 전환을 렌더링하려는 색상입니다. 그라데이션 효과와 함께 시작점과 방향(또는 각도)을 설정할 수도 있습니다.

선형 그라디언트의 예:

선형 그라데이션

버전: CSS3

브라우저 지원

표의 숫자는 기능을 완전히 지원하는 첫 번째 브라우저 버전을 지정합니다.

-webkit-, -moz- 또는 -o- 뒤에 오는 숫자는 접두사와 함께 작동한 첫 번째 버전을 지정합니다.

Function
linear-gradient() 26.0
10.0 -webkit-
10.0 16.0
3.6 -moz-
6.1
5.1 -webkit-
12.1
11.1 -o-


CSS 구문

background-image: linear-gradient(direction, color-stop1, color-stop2, ...);
Value Description
direction Defines a starting point and a direction (or an angle) along with the gradient effect.
color-stop1, color-stop2,... 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: linear-gradient(to right, red , blue);
}

예시

왼쪽 상단에서 시작하여 오른쪽 하단으로 가는 선형 그래디언트:

#grad {
  background-image: linear-gradient(to bottom right, red , blue);
}

예시

지정된 각도의 선형 그래디언트:

#grad {
  background-image: linear-gradient(180deg, red, blue);
}

예시

여러 색상 정지점이 있는 선형 그라디언트:

#grad {
  background-image: linear-gradient(to right, red,orange,yellow,green,blue,indigo,violet);
}

예시

투명도가 있는 선형 그래디언트:

#grad {
  background-image: linear-gradient(to right, rgba(255,0,0,0), rgba(255,0,0,1));
}

관련 페이지

CSS 튜토리얼: CSS 그라디언트


❮ CSS 함수 참조