• 회원가입
  • 로그인
  • 구글아이디로 로그인

[css] CSS - paint-order 속성 - SVG 요소나 텍스트 그려지는 순서 지정 (= paint-order속성 = 페인트오더속성)

목차
  1. paint-order 예제 -  SVG 요소나 텍스트 그려지는 순서 지정
  2. paint-order 정의
  3. paint-order 구문
  4. paint-order 예제 - 무지개색 그라데이션 사용해 SVG <text> 그리기 순서 변경

 

paint-order 예제 -  SVG 요소나 텍스트 그려지는 순서 지정

 

<style>

svg {border:1px solid silver;}

 

circle {

  paint-order: stroke fill;

}

</style>


<svg width="200" height="200">

  <circle cx="100" cy="100" r="80" stroke="blue" stroke-width="20" fill="pink" />

</svg>

 

결과보기

 

paint-order 정의

 

SVG 요소나 텍스트 요소가 그려지는 순서 지정.

 


 

1.

  • 텍스트 요소 경우, 획(stroke)과 채우기(fill) 순서만 변경 가능. (∵ 마커 적용 불가)
  • 기본적으로, 채우기 (fill) 먼저 한 후, 획(stroke) 그음.

 

2.

  • 기본값: normal
  • 적용대상: 텍스트 요소
  • 상속여부: O
  • 애니가능: X
  • CSS버전: CSS3
  • JS구문: object.style.paintOrder="stroke fill";

 

3.

IE 제외한 주요 최신 브라우저 모두 지원.

(단, Chrome, Opera 경우, 일부 지원)

 

4. MDN paint-order 예제보기

https://developer.mozilla.org/en-US/docs/Web/CSS/paint-order

 

 

paint-order 구문

 

selector {paint-order: normal|one value|two values|three values|initial|inherit;}

 


[속성값]

 

normal

fill, stroke, markers 순으로 그리기 진행. (기본값)

 

one value

지정값으로 그리기 시작 후, 기본값 순서로 나머지 그리기 진행.

  • (예) "stroke" 지정 시, 다음 순서는 fill, marker 순으로 진행.

 

three values

지정값으로 그리기 시작 후, 기본값 순서로 나머지 페인팅 진행함. 

  • (예) "stroke markers" 지정 시, 다음 순서는 fill 단계 진행.

 

three values

지정 값 순서대로 그리기 진행.

(예) "markers stroke fill" 지정 시, 이 순서대로 진행.

 

initial

이 속성의 기본값 사용.

 

inherit

부모요소의 속성값 상속.

 

 

paint-order 예제 - 무지개색 그라데이션 사용해 SVG <text> 그리기 순서 변경

 

<style> 

text {

  font-size: 80px;

  font-weight: bold;

  paint-order: stroke fill;

}

</style>


<svg width="100%" height="150">

  <defs>

    <linearGradient id="rainbow" x1="0%" y1="0%" x2="100%" y2="0%">

      <stop offset="0%" style="stop-color:#ef5350;stop-opacity:1" />

      <stop offset="25%" style="stop-color:#7e57c2;stop-opacity:1" />

      <stop offset="50%" style="stop-color:#26c6da;stop-opacity:1" />

      <stop offset="75%" style="stop-color:#eeff41;stop-opacity:1" />

      <stop offset="100%" style="stop-color:#ff5722;stop-opacity:1" />

    </linearGradient>

  </defs>

  <text x="30" y="80" id="hz" fill="url(#rainbow)" stroke="purple" stroke-width="10">Homzzang.com</text>

</svg>

 

결과보기

PS. 색상값 약간 다르게 한 버전


분류 제목
css CSS - place-content 속성(C) - (flex/grid) 레이아웃에서 (수직정렬/수평정렬) 일…
scroll CSS - scroll-padding-inline 속성 -
scroll CSS - scroll-padding-inline-end 속성 -
grid CSS - grid-auto-flow 속성(C) - 그리드 컨테이너 채우는 방식 지정 (= grid-auto…
grid CSS - grid-row-gap 속성 - (※ row-gap으로 이름 바뀜.) 그리드 행 간격 지정 (= …
position CSS - overflow-x 속성 - 수평방향으로 넘치는 내용 처리 방법 지정 (= overflow-x속성…
scroll CSS - scroll-margin 속성 - 스크롤마진 일괄 지정 (= scroll-margin속성 = 스크…
css CSS - isolation 속성 - 요소가 새 스택(stack: 쌓음) 콘텐츠를 생성해야 하는지 여부 지정…
scroll CSS - scroll-behavior 속성 ★ - 스크롤박스 내 동일 페이지 링크 이동 시 부드럽게 이동할…
grid CSS - grid-auto-columns 속성(C) - 그리드 열 너비 일괄 지정 (= grid-auto-…
background CSS - background-position-x 속성 - 배경이미지 x축위치(=수평위치) 설정 (= bac…
grid CSS - grid-row 속성(I) - 그리드 아이템 행 '시작위치와 끝위치 / 크기확장' 지정 (= gr…
grid CSS - grid-row-start 속성(I) - 그리드 아이템 행 시작 위치 및 확장 지정 (= grid…
box CSS - box-decoration-break 속성 - 요소 상자 깨지는 방식 지정 (= box-decor…
image CSS - image-rendering 속성 - 크기 조정 가능 이미지의 렌더링 방식 지정 (= image-…
grid CSS - grid-auto-rows 속성(C) - 그리드 행 높이 일괄 지정 (= grid-auto-row…
scroll CSS - scrollbar-color 속성 - 스크롤바 색상 지정 (= scrollbar-color속성 =…
background CSS - background-blend-mode 속성 - 해당요소 각 (배경색/배경미미지)층의 혼합방식 지…
css CSS - accent-color 속성 - 사용자 제어 선택요소의 색상/색깔 지정 (= accent-colo…
grid CSS - grid-template 속성 - 그리드 행열 및 영역 개별 지정 (= grid-template속…
9/27
목록
찾아주셔서 감사합니다. Since 2012