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

[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. 색상값 약간 다르게 한 버전


분류 제목
gradient CSS - repeating-radial-gradient () 함수 - 방사형 그레이디언트 반복 (= 그라디…
selector CSS - :read-write 가상선택자 - 읽고쓰기가능요소 (= readonly속성없는요소, IE13)
border CSS - border-image-outset 속성 - 테두리 경계 넘는 이미지 양. (= 보더이미지아웃셋속…
selector CSS - :optional 가상선택자 - 선택입력요소 (= required 속성없는 요소, IE10)
responsive CSS - RES Intro - (반응형 웹디자인 소개)
css CSS - 구글 로그인 포커스 애니 효과 (Google Logn Foucs Animation Effect) …
pagination CSS - 페이징 - 둥근테두리 효과 (Rounded bordered pagination)
image CSS - Thumbnail Images - (썸네일 이미지 스타일)
selector CSS - .class1 .class2 클래스선택자 ★★ - class1자손 중 class2 갖는 모든 요소
pagination CSS - 페이징 - 트랜지션 효과 (Hoverable Transition Effect)
gradient CSS - repeating-linear-gradient () 함수 - 반복 선형 그레이디언트 ※ 패턴 배경
border CSS - border-image-source 속성 - 테두리 이미지 주소 (= border-image-so…
image CSS - object-fit 속성 - 컨테이너에 맞게 '이미지/비디오' 크기 조정 방법 지정 (= obje…
pagination CSS - 페이징 - 가운데 정렬 (Centered Pagination)
border CSS - border-right 속성 - 테두리우측일괄 (= 테두리오른쪽일괄 = border-right속성…
animation CSS - animation-timing-function 속성 - 애니재생중속도변화 (= 움직임 중 속도변경…
border CSS - border-left-style 속성 - 테두리좌측모양 (= 테두리왼쪽모양 = border-lef…
border CSS - border-right-color 속성 - 테두리우측색상 (= 테두리오른쪽색상 = 테두리우측색깔…
border CSS - border-image-width 속성 - 테두리 이미지 너비 (= border-image-wid…
border CSS - border-top-style 속성 - 테두리상단모양 (= 테두리상단스타일 = border-top…
14/27
목록
찾아주셔서 감사합니다. Since 2012