Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
191011 SVG를 배경이미지로 활용한 아이콘 - 오혜진
Search
zineeworld
October 11, 2019
Programming
46
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
191011 SVG를 배경이미지로 활용한 아이콘 - 오혜진
zineeworld
October 11, 2019
More Decks by zineeworld
See All by zineeworld
191218 ZINEERUN
zineeworld
0
31
190413 스타트업에서 마크업 개발자로 살아남기 - 오혜진
zineeworld
0
90
Other Decks in Programming
See All in Programming
巨大モノリシックアプリ モダン化大作戦
ktcryomm
0
590
変化を抱擁するドキュメントの作り方 - ビジネスルール駆動開発がもたらす、コードとの新しい関係
ioki
2
150
kubernetes コンポーネント開発入門 / 新卒N年目の勉強会&交流会!〜〇〇への誘い〜 #n_study
mazrean
0
200
個人開発基盤をまるごとCloudflareに引っ越して爆速で総合的体験を向上させた話
tinykitten
0
150
ゲームコントローラやキーボードのファームウェアをSwiftで書く
kishikawakatsumi
1
140
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
330
AI駆動開発にグラフDBを重ねてみた
satoshi256kbyte
2
780
思考垂れ流し開発 ~音声入力 × AIエージェント × 開発ハーネスによる試行錯誤~
npostring
0
1.1k
初心者DevRelとして参加者だった私が、DevRel Talks!#2に登壇するまでにしてきたこと
sokohirai
0
360
新卒PdEのリアル
ryu1013
1
480
ハーネス設計入門 〜プロンプト、コンテキストの次〜
kinopeee
56
37k
モバイル交通系ICへのチャージ実例から考える、クロスプラットフォーム開発におけるiOS実機テスト設計とCI運用
yusuga
1
290
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
The Spectacular Lies of Maps
axbom
PRO
1
990
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
250
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
470
Building Applications with DynamoDB
mza
96
7.2k
Faster Mobile Websites
deanohume
310
32k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
How GitHub (no longer) Works
holman
316
150k
Facilitating Awesome Meetings
lara
57
7.1k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
The Cult of Friendly URLs
andyhume
79
7k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
820
Transcript
@zineeworld SVGܳ ߓ҃۽ ഝਊೠ ই ӝ ੋਗ য়ഌ
@zineeworld য়ט ঠӝ ೞҊ र Ѫ 1. ই ಪী ೠ
ࣗѐ 2. CSS۽ Ӓܽ рױೠ ই 3. background-image: url(‘SVG ٘’)
@zineeworld ই ಪۆ?
@zineeworld औѱ ࢤпೞݶ Bootstrap Glyphicon, Font Awesome ଵҊ : https://webdir.tistory.com/476
@zineeworld Bootstrap Glyphicons Font Awesome
@zineeworld ই ಪ 1. ېझݺਵ۽ औѱ ইਸ ࠛ۞ৢ ࣻ
. 2. ߭ఠ Ӓېਸ ਊೞӝ ٸޙী ࢎૉ ߸҃ ਊೞ. 3. ੌ߈ ఫझী ਊೡ ࣻ ח CSSܳ ࢎਊೡ ࣻ .
@zineeworld ੋਗ ইಪ ઁ https://icomoon.io/ SVG ੌ۽ ୶ػ ইٜਸ icomoon
ࢎܳ ా೧ ইಪ۽ ઁפ. ੋਗীࢲח ٣ցשԋࢲ ೧ সਸ ೧Ҋ ҅भפ.
@zineeworld ѐಞ সਵ۽ ೡ߉ ಕ ࢜ ٣ੋ
@zineeworld
@zineeworld ಕ ղী ߈ࠂਵ۽ ݂ োѾغח ࠗ࠙ী > ই ࢎਊ
ӝઓ ইಪܳ ࢎਊ೧৳؍ ߑध Ӓ۽ <span class=“glyph-ui-chevron-right”></span>ਸ যળ. ਊߑߨ ߈ࠂਵ۽ য ঋҊ ખ ؊ ױࣽೞҊ औѱ ࢎਊೡ ࣻח হਸө?
@zineeworld ইಪח ѐ݃ Ҋਬ ਬפ٘ чਸ оҊ Ӕ1) ইಪ
ਬפ٘ чਸ ڙэ য
@zineeworld ইಪח ѐ݃ Ҋਬ ਬפ٘ чਸ оҊ Ӕ1) ইಪ
ਬפ٘ чਸ ڙэ য
@zineeworld ইಪח ѐ݃ Ҋਬ ਬפ٘ чਸ оҊ (ޙઁ) ਬפ٘
чਸ ݒߣ ࠁ ೡ ࣻ হ Ӕ1) ইಪ ਬפ٘ чਸ ڙэ য
@zineeworld Ӕ2) CSS۽ Ӓ۰ࠅө? border-right: 1px solid currentColor; border-bottom: 1px
solid currentColor; transform: rotate(-45deg); https://codepen.io/zineeworld/pen/ZPxpgp
@zineeworld Ӕ2) CSS۽ Ӓ۰ࠅө? https://codepen.io/zineeworld/pen/PLLydw (ޙઁ) Ѿҗޛ ٣పੌ ର 1px
1.5px 2px
@zineeworld Ӕ3) SVG ٘ܳ ഝਊ ೧ࠅө? 1. <img src=“icon.svg”>
ੌ۽ ࢎਊೠ. 1. ߭ఠ ৈࢲ ӝীח ઁড হਵա ࢚࢝ਸ ߸҃ೞ۰ݶ ܲ ੌ ਃೞ. 2. HTML ٘ উী <svg ~~~~></svg> ܳ ֍ח. 1. 1ߣ ߑߨࠁח ೞա ٘۽ ࢚࢝ чਸ ߸҃ೞӝח ਊೞ. (fill=“colorч”) 2. <span class=“glyph-ui-chevron-right”></span> ࠁ ഻-ঁ ؊ ӟ ٘ܳ ݒߣ ֍যঠ ೠ. 3. svg ٘ী ߸҃ ࢤӝݶ ࢎਊೞҊ ח ݽٚ Ҕਸ ই ߄Լঠ ೠ. 4. ই ࢚࢝ਸ ஶ܀ ೞח Ѥ झఋੌ ੌ۽ ాੌغযঠ ೞחؘ, ߑधਸ ॳݶ html ٘ ࢚ ࣻ ਃೞ. 3. CSS۽ ߓ҃ ࣘࢿী svg ٘ܳ ֍ח. 1. background-image: url(data:image/svg+xml, svg٘); 2. ࢚࢝ ҙܻܳ झఋੌ ੌ ೠ Ҕীࢲ ઁযо оמೞ. SVG ইਸ ࢎਊೞח ߑߨ
@zineeworld Ӕ3) SVG ٘ܳ ഝਊ ೧ࠅө? 1.SVG ٘ܳ background-image ী
֍ӝ 1. IE ਸ ਤ೧ SVG ٘ܳ Data URI ۽ ߸ജೞӝ 2. ߸ജೠ Data URI чਸ ߓ҃ী ֍ӝ 2.Sassܳ ా೧ ࢚࢝ ߸ജ ਊೠ function ٜ݅ӝ 1. Data URI ীח hex чਸ ֍ਸ ࣻ হ? 2. rgba ঌчী 0.999ܳ 3.SVG ٘ܳ ߓ҃۽ ഝਊೠ ই ৮ࢿ!
@zineeworld <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60"> <polygon fill="black" points="20.62
55.62 45.74 30.5 20.62 5.38 16.38 9.62 37.26 30.5 16.38 51.38 20.62 55.62"> </svg> SVG ٘ܳ ಝࠅөਃ? ױࣽೠ ಫܻҌਵ۽ ܖযઉ णפ. Ӕ3) SVG ٘ܳ ഝਊ ೧ࠅө?
@zineeworld .icon display: inline-block width: 1em height: 1em background: url("data:image/svg+xml,<svg
xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60'><polygon fill='rgba(23, 114, 248, 0.999)' points='20.62 55.62 45.74 30.5 20.62 5.38 16.38 9.62 37.26 30.5 16.38 51.38 20.62 55.62'/></svg>") no-repeat Sass) background-image: url() ী SVG ٘ܳ ֍যࠇद. ۧѱ ೧ب ࠗ࠙ ࠳ۄীࢲח زೞ݅ IE ীࢲח ڰ ঋणפ. Ӕ3) SVG ٘ܳ ഝਊ ೧ࠅө?
@zineeworld Ӕ3) SVG ٘ܳ ഝਊ ೧ࠅө? https://zineeworld.github.io/demo/svg_fonticon_test.html Windows (ઝஏ ࢚ױࠗఠ
द҅ߑೱਵ۽ ܁ >> যझ >> Edge >> IE11) MacOS (ઝஏࠗఠ ܁ >> ࢎܻ >> যझ) IEীࢲח Data URI۽ ߸ജ೧ࢲ ֍ ٘݅ ࢚ ֢ؽ > : Data URI > : SVG
@zineeworld SVG → Data URI ߸ജ ߑߨ Ӕ3) SVG ٘ܳ
ഝਊ ೧ࠅө? https://runkit.com/zineeworld/convert-svg-to-data-uri
@zineeworld Ӕ3) SVG ٘ܳ ഝਊ ೧ࠅө? .icon display: inline-block width:
1em height: 1em background: url(“data:image/ svg+xml,data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60'%3E%3Cpolygon fill='black' points='20.62 55.62 45.74 30.5 20.62 5.38 16.38 9.62 37.26 30.5 16.38 51.38 20.62 55.62'/%3E%3C/svg%3E ") no-repeat Sass) background-image: url() ী ߸ജೠ Data URI ٘ܳ ֍যࠇद.
@zineeworld Ӕ3) SVG ٘ܳ ഝਊ ೧ࠅө? @function svgIcon($color) $icon: "data:image/svg+xml,%3Csvg
xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60'%3E%3Cpolygon fill='#{$color}' points='20.62 55.62 45.74 30.5 20.62 5.38 16.38 9.62 37.26 30.5 16.38 51.38 20.62 55.62'/ %3E%3C/svg%3E" @return url($icon) .icon display: inline-block width: 1em height: 1em background: svgIcon(#1772f8) no-repeat Sassܳ ా೧ ࢚࢝ ߸ജ ਊೠ function ٜ݅ӝ
@zineeworld Ӕ3) SVG ٘ܳ ഝਊ ೧ࠅө? @function svgIcon($color) $icon: "data:image/svg+xml,%3Csvg
xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60'%3E%3Cpolygon fill='#{$color}' points='20.62 55.62 45.74 30.5 20.62 5.38 16.38 9.62 37.26 30.5 16.38 51.38 20.62 55.62'/ %3E%3C/svg%3E" @return url($icon) .icon display: inline-block width: 1em height: 1em background: svgIcon(#1772f8) no-repeat Sassܳ ా೧ ࢚࢝ ߸ജ ਊೠ function ٜ݅ӝ (ޙઁ) fill чীח hex ٘ܳ ֍ਸ ࣻ হ!!
@zineeworld Ӕ3) SVG ٘ܳ ഝਊ ೧ࠅө? @function svgIcon($color) $color: rgba($color,
1.0) $icon: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60'%3E%3Cpolygon fill='#{$color}' points='20.62 55.62 45.74 30.5 20.62 5.38 16.38 9.62 37.26 30.5 16.38 51.38 20.62 55.62'/ %3E%3C/svg%3E" @return url($icon) .icon display: inline-block width: 1em height: 1em background: svgIcon(#1772f8) no-repeat Sassܳ ా೧ ࢚࢝ ߸ജ ਊೠ function ٜ݅ӝ <<< ۧѱ ೞݶ ؼ ঌওਵա ژ উ ؽ…
@zineeworld Ӕ3) SVG ٘ܳ ഝਊ ೧ࠅө? @function svgIcon($color) $color: rgba($color,
1.0) $icon: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60'%3E%3Cpolygon fill='#{$color}' points='20.62 55.62 45.74 30.5 20.62 5.38 16.38 9.62 37.26 30.5 16.38 51.38 20.62 55.62'/ %3E%3C/svg%3E" @return url($icon) .icon display: inline-block width: 1em height: 1em background: svgIcon(#1772f8) no-repeat Sassܳ ా೧ ࢚࢝ ߸ജ ਊೠ function ٜ݅ӝ (ޙઁ) rgba(#ffffff, 1.0) = #ffffff rgba(#ffffff, 1.0) != rgba(255,255,255,1.0)
@zineeworld Ӕ3) SVG ٘ܳ ഝਊ ೧ࠅө? Ӓۧݶ ঌчী 0.999ܳ ݶ
যڄө? ੌױ ٣झۨ غח Ѿҗч য়ରо হਸ ഛੋ!
@zineeworld Ӕ3) SVG ٘ܳ ഝਊ ೧ࠅө? @function svgIcon($color) $color: rgba($color,
0.999) $icon: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60'%3E%3Cpolygon fill='#{$color}' points='20.62 55.62 45.74 30.5 20.62 5.38 16.38 9.62 37.26 30.5 16.38 51.38 20.62 55.62'/ %3E%3C/svg%3E" @return url($icon) .icon display: inline-block width: 1em height: 1em background: svgIcon(#1772f8) no-repeat Sassܳ ా೧ ࢚࢝ ߸ജ ਊೠ function ٜ݅ӝ ٘٣য ৮ࢿ!
@zineeworld Ӕ3) SVG ٘ܳ ഝਊ ೧ࠅө? @function svgIcon($color) $color: rgba($color,
0.999) $icon: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60'%3E%3Cpolygon fill='#{$color}' points='20.62 55.62 45.74 30.5 20.62 5.38 16.38 9.62 37.26 30.5 16.38 51.38 20.62 55.62'/ %3E%3C/svg%3E" @return url($icon) .icon display: inline-block width: 1em height: 1em background: svgIcon(#1772f8) no-repeat &:hover background: svgIcon(#000000) no-repeat Sassܳ ా೧ ࢚࢝ ߸ജ ਊೠ function ٜ݅ӝ hoverद ߸҃࢝ ۧѱ // SVG ٘о background-image чਵ۽ ٜযр ҃ currentColor ࢎਊࠛо // fill='currentColor' ۄҊ ա زೞ ঋ, ױࣽ ޙৌ غযߡܿ
@zineeworld https://codepen.io/zineeworld/pen/XGYNZp
@zineeworld • https://medium.com/coinone-official/svg%EB%A5%BC- %EB%B0%B0%EA%B2%BD%EC%9D%B4%EB%AF%B8%EC%A7%80 %EB%A1%9C-%ED%99%9C%EC%9A%A9%ED%95%9C- %EC%95%84%EC%9D%B4%EC%BD%98- %EC%82%AC%EC%9A%A9%EA%B8%B0-d46e681b492f • https://codepen.io/noahblon/post/coloring-svgs-in-css-background-images •
https://codepen.io/noahblon/pen/xGbXdV?editors=1100 • https://codepen.io/tigt/post/optimizing-svgs-in-data-uris ଵҊܐ
@zineeworld