Par Valentin Brosseau / @c4software
font-size16px (précis mais rigide)1.2em (s'adapte au contexte) 👍em1.3em = « 30 % plus grand que le parent »
⚠️ Le séparateur est un point : 1.3em
font-familybody {
font-family: Verdana, Arial, sans-serif;
}On donne donc des polices de secours, de la préférée à la plus générique.
(Et Google Fonts pour aller plus loin)
| Propriété | Valeurs |
|---|---|
font-weight |
normal, bold, 100 à 900 |
font-style |
normal, italic |
text-decoration |
underline, line-through, none |
strong ou font-weight: bold ?<strong> : « ce mot est important » (HTML)font-weight: bold : « ce texte est épais » (CSS)text-alignleft, center, right, justify
⚠️ Uniquement sur les balises « block »

img {
float: left;
}Et clear: both pour arrêter l'habillage.
red, blue, teal…Rapidement limité. Seulement 140 couleurs

La notation universelle du design.
color: rgb(246, 243, 242);Identique à l'hexadécimal, en décimal.

Un « Color Picker » (IDE, en ligne, Google)
body {
background: black;
color: white;
}Même les p, sans aucune règle sur p…
Les enfants héritent des propriétés de leurs parents.
C'est le « C » de CSS : Cascading.
body.body { color: #333; }
h1 { color: #1d2d3a; } /* Plus précis : gagne */body {
background-image: url("../img/motif.png");
}
| Propriété | Valeurs |
|---|---|
| background-repeat | no-repeat, repeat-x, repeat-y, repeat |
| background-attachment | fixed, scroll |
| background-position | en pixel, ou top, bottom, left, right, center |
body {
background-image: url("logo.png");
background-attachment: fixed;
background-repeat: no-repeat;
background-position: center;
}
background: url("logo.png") fixed no-repeat center;Dans un fichier CSS, url(…) est relatif…
img {
opacity: 0.6; /* 60 % opaque */
}S'applique à l'élément entier (enfants compris).
em, polices avec secours.background, chemin relatif à la CSS.body, on affine ensuite.Place au TP 🚀