SlideShare une entreprise Scribd logo
1  sur  20
Télécharger pour lire hors ligne
20 minutes de typos en css
Meetup Frontseeds @Tournai 11/10/2018
Bord*$`l, il y a trop à dire...
font-family: ‘Lora’, ‘Times New Roman’, Georgia, serif;
1) font à télécharger via @font-face
2) font susceptible d’être disponible localement
3) font générique, dernier élément de liste
@font-face {
font-family: 'Lora';
font-style: normal;
font-weight: 400;
src: url(url de la font) format("woff2"),
url(url de la font) format("woff");
unicode-range: intervalle de caractères;
}
TTF (TrueType Font) : format non compressé réalisé dans les années 80.
OTF (OpenType Font) : évolution de TTF réalisé en 2009. Bonne compatibilité.
EOT (Embedded OpenType Fonts) : version compressée du format OTF prévu
pour IE.
WOFF / WOFF2 (Web Open Font Format) : format purement web; c’est une
évolution de TTF et OTF qui dispose de métas supplémentaires pour un
chargement plus rapide. Il bénéficie d’une compatibilité accrue.
Optimiser les performances
1) Font Face Observer (https://fontfaceobserver.com/)
2) Critical CSS (https://gist.github.com/scottjehl/b6129da04733e4e0f9a4)
3) Meowni Font Style Matcher (https://meowni.ca/font-style-matcher/)
4) Asynchronous CSS (https://www.filamentgroup.com/lab/async-css.html)
Alternative
1) Font-display: swap;
2) Asynchronous CSS (https://www.filamentgroup.com/lab/async-css.html)
font-size: calc(1em + .2vw);
body { font-size: 1.125rem; }
h1 { font-size: 4em; }
h2 { font-size: 3.4em; }
p { font-size: 1em; }
.text-small { font-size: .6em; }
p { font-size: 1em; }
@media (min-width: responsive start) {
p { font-size: calc(1em + .2vw); }
}
@media (min-width: responsive end) {
p { font-size: 2em; }
}
body {
font-size: calc(
[minimum size] + ([maximum size] - [minimum size]) *
((100vw - [minimum viewport width]) /
([maximum viewport width] - [minimum viewport width]))
);
}
Quelques ressources
https://www.smashingmagazine.com/2017/05/fluid-responsive-typography-css-p
oly-fluid-sizing/
https://css-tricks.com/snippets/css/fluid-typography/
https://www.smashingmagazine.com/2016/05/fluid-typography/
https://www.madebymike.com.au/writing/precise-control-responsive-typography/
https://codepen.io/bhenbe/pen/wxXwLO
h1 { line-height: 1.1; }
p { line-height: 1.5; }
@media (min-height: 28rem) {
p { line-height: 1.3; }
}
p { max-width: 64ch; }
p { font-size: 1em; }
p::first-letter { font-size: 3em; }
p::first-line { font-weight: bold; }
p {
display: box;
line-clamp: 2;
}
.element {
shape-outside: ellipse(100px 200px at 50% 50%);
width: 300px;
height: 500px;
}
.element {
shape-outside: url('circle.png');
}
#font-amstelvar {
font-family: 'AmstelvarAlpha';
font-variation-settings: 'wdth' 400, 'wght' 98;
}
Quelques ressources
https://www.axis-praxis.org/
https://developers.google.com/web/fundamentals/design-and-ux/typography/
variable-fonts/
https://v-fonts.com/
https://www.axis-praxis.org/resources
https://vimeo.com/241102754
Et j’ai certainement oublié plein de trucs,
put$*ù de bord$¨` de m$rde...
Merci de m’avoir subi.
Benoit Henry
contact@bhen.be
https://bhen.be

Contenu connexe

Similaire à 20 minutes sur les typos en CSS

Web typographie
Web typographieWeb typographie
Web typographiemirko
 
Chapitre 1_HTML_complet_version1.pdf
Chapitre 1_HTML_complet_version1.pdfChapitre 1_HTML_complet_version1.pdf
Chapitre 1_HTML_complet_version1.pdfYassineZARIOUH
 
Réu technodejs
Réu technodejsRéu technodejs
Réu technodejsnaholyr
 
HTML 5 et CSS3, créez, animez et enrichissez vos sites Web
HTML 5 et CSS3, créez, animez et enrichissez vos sites WebHTML 5 et CSS3, créez, animez et enrichissez vos sites Web
HTML 5 et CSS3, créez, animez et enrichissez vos sites WebMicrosoft
 
Tutoriel slideshare3
Tutoriel slideshare3Tutoriel slideshare3
Tutoriel slideshare3Rabolliot
 
Css maintenable - Morgane Hervé
Css maintenable - Morgane HervéCss maintenable - Morgane Hervé
Css maintenable - Morgane HervéWeb à Québec
 
Rich Desktop Applications
Rich Desktop ApplicationsRich Desktop Applications
Rich Desktop Applicationsgoldoraf
 
Séminaire Ruby on Rails (novembre 2010)
Séminaire Ruby on Rails (novembre 2010)Séminaire Ruby on Rails (novembre 2010)
Séminaire Ruby on Rails (novembre 2010)Novelys
 
Développement Web
Développement WebDéveloppement Web
Développement Webmastertic
 
Développement Web
Développement WebDéveloppement Web
Développement Webmastertic
 
cours-gratuit.com--coursMySql-id2218.pdf
cours-gratuit.com--coursMySql-id2218.pdfcours-gratuit.com--coursMySql-id2218.pdf
cours-gratuit.com--coursMySql-id2218.pdfGroupeExcelMarrakech
 
Digital race evolution programmation web 1.0
Digital race   evolution programmation web 1.0Digital race   evolution programmation web 1.0
Digital race evolution programmation web 1.0Sequoia-ID
 
Introduction dans la Programmation Web Course 1
Introduction dans la Programmation Web Course 1Introduction dans la Programmation Web Course 1
Introduction dans la Programmation Web Course 1Vlad Posea
 
Jump Camp - HTML5
Jump Camp - HTML5Jump Camp - HTML5
Jump Camp - HTML5chaudavid
 
Les Web Services en 60 diapos chrono !
Les Web Services en 60 diapos chrono !Les Web Services en 60 diapos chrono !
Les Web Services en 60 diapos chrono !Olivier Le Goaër
 
Presentation langage go_19022015
Presentation langage go_19022015Presentation langage go_19022015
Presentation langage go_19022015Stéphane Legrand
 

Similaire à 20 minutes sur les typos en CSS (20)

Web typographie
Web typographieWeb typographie
Web typographie
 
Chapitre 1_HTML_complet_version1.pdf
Chapitre 1_HTML_complet_version1.pdfChapitre 1_HTML_complet_version1.pdf
Chapitre 1_HTML_complet_version1.pdf
 
Réu technodejs
Réu technodejsRéu technodejs
Réu technodejs
 
HTML 5 et CSS3, créez, animez et enrichissez vos sites Web
HTML 5 et CSS3, créez, animez et enrichissez vos sites WebHTML 5 et CSS3, créez, animez et enrichissez vos sites Web
HTML 5 et CSS3, créez, animez et enrichissez vos sites Web
 
Tutoriel slideshare3
Tutoriel slideshare3Tutoriel slideshare3
Tutoriel slideshare3
 
Css maintenable - Morgane Hervé
Css maintenable - Morgane HervéCss maintenable - Morgane Hervé
Css maintenable - Morgane Hervé
 
Rich Desktop Applications
Rich Desktop ApplicationsRich Desktop Applications
Rich Desktop Applications
 
Séminaire Ruby on Rails (novembre 2010)
Séminaire Ruby on Rails (novembre 2010)Séminaire Ruby on Rails (novembre 2010)
Séminaire Ruby on Rails (novembre 2010)
 
Développement Web
Développement WebDéveloppement Web
Développement Web
 
Découverte HTML5/CSS3
Découverte HTML5/CSS3Découverte HTML5/CSS3
Découverte HTML5/CSS3
 
Développement Web
Développement WebDéveloppement Web
Développement Web
 
Atelier template
Atelier templateAtelier template
Atelier template
 
Dynamic Languages
Dynamic LanguagesDynamic Languages
Dynamic Languages
 
cours-gratuit.com--coursMySql-id2218.pdf
cours-gratuit.com--coursMySql-id2218.pdfcours-gratuit.com--coursMySql-id2218.pdf
cours-gratuit.com--coursMySql-id2218.pdf
 
Digital race evolution programmation web 1.0
Digital race   evolution programmation web 1.0Digital race   evolution programmation web 1.0
Digital race evolution programmation web 1.0
 
Introduction dans la Programmation Web Course 1
Introduction dans la Programmation Web Course 1Introduction dans la Programmation Web Course 1
Introduction dans la Programmation Web Course 1
 
Jump Camp - HTML5
Jump Camp - HTML5Jump Camp - HTML5
Jump Camp - HTML5
 
Les Web Services en 60 diapos chrono !
Les Web Services en 60 diapos chrono !Les Web Services en 60 diapos chrono !
Les Web Services en 60 diapos chrono !
 
Lp web tp3_idse
Lp web tp3_idseLp web tp3_idse
Lp web tp3_idse
 
Presentation langage go_19022015
Presentation langage go_19022015Presentation langage go_19022015
Presentation langage go_19022015
 

20 minutes sur les typos en CSS