Top Banner
really and SVG How I learnt to stop using icon fonts
78

How i learned to stop using icon fonts and love svg (again)

Apr 15, 2017

Download

Design

sarah semark
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: How i learned to stop using icon fonts and love svg (again)

really

and SVGHow I learnt to stop using icon fonts

Page 2: How i learned to stop using icon fonts and love svg (again)

Hello!

Page 3: How i learned to stop using icon fonts and love svg (again)
Page 4: How i learned to stop using icon fonts and love svg (again)
Page 5: How i learned to stop using icon fonts and love svg (again)
Page 6: How i learned to stop using icon fonts and love svg (again)
Page 7: How i learned to stop using icon fonts and love svg (again)

1000 WORDSA picture is worth

Page 8: How i learned to stop using icon fonts and love svg (again)
Page 9: How i learned to stop using icon fonts and love svg (again)

Tree Woods Forest

Page 10: How i learned to stop using icon fonts and love svg (again)

🍆🙈🩄

Page 11: How i learned to stop using icon fonts and love svg (again)
Page 12: How i learned to stop using icon fonts and love svg (again)

Mexico City

Metro System

TL

TL

3

3

7

76 6

4

4

5

519 A

19

A

8

8B

B

2

2

12

12

Coyuya

El Rosario

Autobusesdel Norte

Indios Verdes

La Villa - BasĂ­lica

EduardoMolina

San AntonioAbad PantitlĂĄn

Ciudad Azteca

Plaza AragĂłn

OlĂ­mpica

Ecatepec

MĂșzquiz

RĂ­o de los Remedios

Impulsora

NezahualcĂłyotl

Villa de AragĂłn

Bosque de AragĂłn

Deportivo OceanĂ­a

OceanĂ­a

Terminal AĂ©rea

Hangares

AgrĂ­cola Oriental

Canal de San Juan

Tepalcates

Guelatao

PeñonViejo

Acatitla SantaMarta

Los Reyes La Paz

PueblaCiudadDeportiva

VelĂłdromoMixiuhca

Zaragoza

GĂłmezFarĂ­as

Boulevard Puerto AĂ©reo

Balbuena

Moctezuma

RomeroRubioRicardo Flores

MagĂłn

SanLĂĄzaro

Canal delNorte

Candelaria

Merced FrayServando

Jamaica

Tepito

Morelos

LagunillaGaribaldi

Allende

ZĂłcalo

Isabel laCatĂłlica

PinoSuĂĄrez

Chabacano

San Juande LetrĂĄn

Salto delAgua

Bellas Artes

Hidalgo

Guerrero

AragĂłn

TalismĂĄn

Consulado

→

La Viga

La Raza

Bondojito

MartĂ­nCarrera

Deportivo18 de Marzo

Potrero

Lindavista

Politécnico

Insituto delPetrĂłleo

VallejoNorte 45FerrerĂ­aAzcapotzalcoTezozĂłmoc

Aquiles SerdĂĄn

Camarones

RefinerĂ­a

San JoaquĂ­n

Polanco

Auditorio

Constituyentes

San Pedrode los Pinos

San Antonio

Barrancadel Muerto

Buenavista

Tlatelolco

Misterios

Valle GĂłmez

JuĂĄrez

RevoluciĂłnSanCosme

NormalColegioMilitar

PopotlaCuitlĂĄhuacPanteones

CuatroCaminos Tacuba

Observatorio

Tacubaya

Mixcoac

JuanacatlĂĄn

Chapultepec

Sevilla

Insurgentes

Cuauhtémoc

Balderas

Doctores

Obrera

NiñosHéroes

HospitalGeneral

CentroMĂ©dico

EtiopĂ­a

Eugenia

DivisiĂłndel Norte

Zapata

CoyoacĂĄn

Viveros

Miguel Ángelde Quevedo

Copilco

Universidad

Patriotismo Chilpancingo LĂĄzaro CĂĄrdenas

Viaducto

Xola

Villa de Cortés

Nativitas

Portales

Ermita

GeneralAnaya

Tasqueña

Tasqueña

Insurgentes Sur Hospital20 de Noviembre

Parque delos Venados

Eje Central Mexicaltzingo

Atlalilco

CulhuacĂĄn

San AndrésTomatlån

LomasEstrella

Calle 11 PeriféricoOriente

Tezonco Olivos Nopalera ZapotitlĂĄn Tlaltenco TlĂĄhuac

Santa Anita

Iztacalco

Apatlaco

Aculco

EscuadrĂłn 201

Iztapalapa Cerro de la Estrella

UAM-I ConstituciĂłnde 1917

Las Torres

Ciudad JardĂ­n

La Virgen

Xotepingo

Nezahualpilli

Registro Federal

TextitlĂĄn

El Vergel EstadioAzteca

Huipulco Xomali Periférico Tepepan La Noria Huichapan FranciscoGoitia

Xochimilco

The scale in this map is not 100% geographically accurate, especially for the Tren Ligero.

The logos reproduced herein are copyright of the STC.

This map put together by Richard ([email protected] / @richardmtl )

Page 13: How i learned to stop using icon fonts and love svg (again)

ICONSmake for better communication

Page 14: How i learned to stop using icon fonts and love svg (again)
Page 15: How i learned to stop using icon fonts and love svg (again)
Page 16: How i learned to stop using icon fonts and love svg (again)
Page 17: How i learned to stop using icon fonts and love svg (again)

Menu

Page 18: How i learned to stop using icon fonts and love svg (again)

ICONSmake for better websites

Page 19: How i learned to stop using icon fonts and love svg (again)
Page 20: How i learned to stop using icon fonts and love svg (again)

38!

Page 21: How i learned to stop using icon fonts and love svg (again)

SPRITELYCSS solutions

Page 22: How i learned to stop using icon fonts and love svg (again)
Page 23: How i learned to stop using icon fonts and love svg (again)

.twitter-icon { background-position: 102px -48px; }

Page 24: How i learned to stop using icon fonts and love svg (again)

RESCUE!Icon fonts to the

Page 25: How i learned to stop using icon fonts and love svg (again)

HACKIcon fonts are a

Page 26: How i learned to stop using icon fonts and love svg (again)

SVG.What’s next?

Page 27: How i learned to stop using icon fonts and love svg (again)

<svg> <path class="heart" d="M25.79,10.7a4.77,4.77,..." /> </svg>

Page 28: How i learned to stop using icon fonts and love svg (again)
Page 29: How i learned to stop using icon fonts and love svg (again)
Page 30: How i learned to stop using icon fonts and love svg (again)

BOTHER?Why should I

Page 31: How i learned to stop using icon fonts and love svg (again)

REASONSyou should switch to SVG

5

Page 32: How i learned to stop using icon fonts and love svg (again)

SEMANTICS.Perhaps you care about1

Page 33: How i learned to stop using icon fonts and love svg (again)

2 ACCESSIBILITYis better out-of-the-box.

Page 34: How i learned to stop using icon fonts and love svg (again)

<svg> <title>Heart</title> <desc>A fluorescent teal heart.</desc> <path class="heart" d="M25.79,10.7a4.77,4.77,..." /> </svg>

Page 35: How i learned to stop using icon fonts and love svg (again)
Page 36: How i learned to stop using icon fonts and love svg (again)

LOOK BETTERYour icons are going to3

Page 37: How i learned to stop using icon fonts and love svg (again)

.heart { fill: #B9FDFE; }

Page 38: How i learned to stop using icon fonts and love svg (again)

.heart { fill: none; stroke: #B9FDFE; stroke-width: 2px; }

Page 39: How i learned to stop using icon fonts and love svg (again)

.heart { fill: #B9FDFE; }

.arrow { fill: #FD80E5; }

Page 40: How i learned to stop using icon fonts and love svg (again)

.arrow { transition: all 0.5s ease-in; transform: translate (20, -20); }

Page 41: How i learned to stop using icon fonts and love svg (again)

FAILUREis an awful lot less likely.

4

Page 42: How i learned to stop using icon fonts and love svg (again)
Page 43: How i learned to stop using icon fonts and love svg (again)
Page 44: How i learned to stop using icon fonts and love svg (again)
Page 45: How i learned to stop using icon fonts and love svg (again)
Page 46: How i learned to stop using icon fonts and love svg (again)

BROWSERSHappier

5

Page 47: How i learned to stop using icon fonts and love svg (again)
Page 48: How i learned to stop using icon fonts and love svg (again)

4.5per cent of global browser usage

Page 49: How i learned to stop using icon fonts and love svg (again)

OKAYI’m convinced.

HOW DO I DO IT?

Page 50: How i learned to stop using icon fonts and love svg (again)

POISONChoose your

Page 51: How i learned to stop using icon fonts and love svg (again)

DATA URI

Page 52: How i learned to stop using icon fonts and love svg (again)

.skull-icon { background-image: url(‘data:image/svg+xmldata:application/octet-stream;base64,CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMzIgMzIiPgoJPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5oZWFydCB7CgkJZmlsbDogI2I2ZmRmTQsNS42NSw3LjQ3LDguNDEsMi41NC0yLjc2LDUuMTItNS40OSw3LjUtOC40MSwxLjczLTIuMTEsMi45MS0zLjg1LDIuMzgtNi42M2gwWiIgLz4KPC9zdmc+Cg
’); background-repeat: no-repeat; background-position: 50% 50%; height: 1em; width: 1em; }

Page 53: How i learned to stop using icon fonts and love svg (again)

<span class=“skull-icon”> </span>

Page 54: How i learned to stop using icon fonts and love svg (again)

SYMBOL

Page 55: How i learned to stop using icon fonts and love svg (again)

<svg style="display: none"> <symbol id="heart-icon"> <...> </symbol> <symbol id="skull-icon"> <...> </symbol>

</svg>

Page 56: How i learned to stop using icon fonts and love svg (again)

<svg class="skull-icon"> <use xlink:href="#skull-icon"></use> <svg>

Page 57: How i learned to stop using icon fonts and love svg (again)

<svg class="skull-icon"> <use xlink:href="icons.svg#skull-icon"></use> <svg>

Page 58: How i learned to stop using icon fonts and love svg (again)

BEST FRIENDReusable, modular code is your

Page 59: How i learned to stop using icon fonts and love svg (again)

<?php themeslug_icon( 'skull' ); ?>

Page 60: How i learned to stop using icon fonts and love svg (again)

[themeslug-icon name="skull"]

Page 61: How i learned to stop using icon fonts and love svg (again)

TASK RUNNERSYour other best friend forever.

Page 62: How i learned to stop using icon fonts and love svg (again)
Page 63: How i learned to stop using icon fonts and love svg (again)

SOCIAL MENUS?But what about my

Page 64: How i learned to stop using icon fonts and love svg (again)

add_filter( 'wp_nav_menu_objects', 'themeslug_social_menu' );

Page 65: How i learned to stop using icon fonts and love svg (again)

<a href=“http://twitter.com/sarahsemark”>Twitter</a>

Page 66: How i learned to stop using icon fonts and love svg (again)

<a href=“http://twitter.com/sarahsemark”> <svg class=“twitter-icon”> 
 </svg> <span class=“screen-reader-text”>Twitter</span> </a>

Page 67: How i learned to stop using icon fonts and love svg (again)

JETPACKsocial menus

Page 68: How i learned to stop using icon fonts and love svg (again)

add_theme_support( ‘jetpack-social-menu‘ );

function themeslug_social_menu() { if ( has_nav_menu( ‘jetpack-social-menu‘ ) ) : ?> <nav class=“jetpack-social-navigation” role=“navigation”> <?php wp_nav_menu( array ( ‘theme_location’ => ‘jetpack-social-menu’, ‘link_before’ => ‘’, ‘link_after’ => ‘’, ) ); ?> </nav> <?php endif; }

Page 69: How i learned to stop using icon fonts and love svg (again)

REACT?what if I’m using

Page 70: How i learned to stop using icon fonts and love svg (again)

const SkullIcon = React.createClass( { render() { return( <svg className=“skull-icon”> 
 </svg> ) } } );

Page 71: How i learned to stop using icon fonts and love svg (again)

ACCESSIBLE?How do I make sure all this is

Page 72: How i learned to stop using icon fonts and love svg (again)

<svg aria-hidden="true"> <use xlink:href="#skull-icon"></use> </svg>

Page 73: How i learned to stop using icon fonts and love svg (again)

<svg role="img" aria-labelledby=“skull-title"> <title id="#skull-title">skull</title> <use xlink:href="#skull-icon"></use> </svg>

Page 74: How i learned to stop using icon fonts and love svg (again)

<a href="#" aria-label="Delete all items"> <svg> <use xlink:href="#skull-icon"></use> </svg> </a>

Page 75: How i learned to stop using icon fonts and love svg (again)

FALLBACKSa quick word about

Page 76: How i learned to stop using icon fonts and love svg (again)

<svg> 
 <image src="skull.png" xlink:href=""/> </svg>

Page 77: How i learned to stop using icon fonts and love svg (again)

THANKS FOR FLYING!

Page 78: How i learned to stop using icon fonts and love svg (again)

QUESTIONS?@sarahsemark

github.com/sarahmonster/easy-as-svg

triggersandsparks.com/talks/svg-icons