Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
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
88
Other Decks in Programming
See All in Programming
ドリフトを絶対に許さない(?)CDK運用 / CDK Ops with Zero Tolerance for Drifts (?)
akihisaikeda
1
220
My Marp Sample
sinoue0108
0
110
まずはプロンプトガイドを読もう、話はそれからだ
kiakiraki
1
200
生成AIで帳票OCRが「簡単に」作れる時代になった?
kon_shou
0
1.2k
片田舎のおっさん、 Swift Buildのダイアモンド問題解決の不具合修正PRを出すが、解決方法がキャッシュをしないようにすることであり、ビルド時間が伸びると言われてマージされないので高速化もする/swiftbuild
yimajo
0
270
Cloudflare is Agents
chimame
0
180
<title><a id="</title>君はこのHTMLをパースできるか"></a></title> #雑LT_study
pizzacat83
0
170
AI Readyの正体はデータマネジメントだ メダリオン2.0の最前線
freee
PRO
0
360
プロポーザルを書いてもらう
pvcresin
0
580
Hono + Inertia + React で LP を構築した話
oukayuka
2
150
【QA Test Talk Vol.8】AI-DLC による Whole Team Approach の加速
pkshadeck
PRO
0
220
AWS Transform Customによる Spring Boot 2.xから4.xへのVerUp
satoshi256kbyte
2
100
Featured
See All Featured
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
310
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.1k
GraphQLとの向き合い方2022年版
quramy
50
15k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4.2k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
210
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
480
Believing is Seeing
oripsolob
1
200
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
520
Thoughts on Productivity
jonyablonski
76
5.3k
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