Develop

[html] SVG(Scalable Vector Graphics) 간단 정리

by hooni posted Feb 13, 2014
?

Shortcut

PrevPrev Article

NextNext Article

ESCClose

Larger Font Smaller Font Up Down Go comment Print
# SVG 란?
SVG (Scalable Vector Graphics)
2차원 벡터(vector) 그래픽 표현을 위한 XML기반의 파일 형식
※ XML : 확장성 마크업 언어(Extensible Markup Language)은 전자 데이터 교환에 대한 표준을 정의.


# SVG의 장점
- Resolution Independent(해상도 독립)
- Styling And Scripting
- Can Be Animated And Edited
- Smarller File Size


# 지원 브라우저
- IE 9 이상
- Chrome
- Safari
- Opera
- Firefox
- Android browser
- Blackberry


# SVG 렌더링 방식

1. 독립형 SVG (StandAlone SVG)
 > 독립된 SVG 포맷 파일을 사용하는 방법.
<svg xmlns=http://www.w3.org/2000/svg width="100" height="100">
    <line x1="0" y1="100" x2="100" y2="0" stroke-width="2" stroke="black" />
</svg>

2. 삽입형 SVG (Embed SVG)
 > object, iframe, embed, img 태그 또는 css background-image를 통해 독립형 SVG를 삽입하는 방법.
 > 독립형 SVG를 호출하는 페이지에서는 SVG 컨텐츠를 스크립팅 하기 어려울 수 있음.
<body>
    <iframe src="HelloSVG_line.svg" type="image/svg+xml"></iframe>
</body>

3. 인라인 SVG (Inline SVG)
 > HTML 문서 안에 SVG 태그를 직접 사용하는 방법.
<body>
  <svg width="100" height="100">
    <line x1="0" y1="100" x2="100" y2="0" stroke-width="2" stroke="black" />
  </svg>
</body>