initiation au web statiquechristophe.delagarde.free.fr/formation/html5-css3.pdf · 52 html5 / css3...

91
HTML5 / CSS3 Initiation au Web Statique 1

Upload: others

Post on 15-Mar-2020

38 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 Initiation au Web Statique

1

Page 2: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML 5

Dernière version de HTML (28 oct. 2014)

Rich Interface Applications

Langage balisé

Basé sur XHTML

HTML5 / CSS3 2

Page 3: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML 5 & Adobe Flash

Adobe Flash est un complément d’HTML5

Taux de pénétration :

Encore faible (75 %) pour HTML5

Flash (≈ 99 % sur PC, ≈ 80 % sur mobile)

supérieur à JavaScript (≈ 90 %) !

HTML5 / CSS3 3

2011

Page 4: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

CSS 3

Prochaine version de CSS (depuis 1999)

CSS4 déjà en route (depuis 2010)

Préfixes propriétaires :

-moz-

-webkit-

-o-

-ms-

-khtml-

HTML5 / CSS3 4

Page 5: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML / CSS

May 13, 2015 5

HTML

Fond - Contenu

(textes, liens, images,

etc.)

CSS

Forme - Apparence

(agencement, déco.,

couleur, etc.)

Page 6: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML : bases

HTML5 / CSS3 6

Balise = nom encadré par < et > Balise simple : <balise/>

Balise double : <balise> {texte} </balise>

Attribut = spécialisation de balise attribut="valeur"

Attributs communs

id name style title onclick onfocus onmouseover onmousemove onkeypress

dir lang class onload onchange onblur onmouseout onmousedown onselect

Page 7: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML 5 simplification

HTML5 / CSS3 7

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" > <head> <title>Titre de la page</title> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> </head> <body> <!-- Ici votre site Web --> </body> </html>

Page 8: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML 5 simplification

HTML5 / CSS3 8

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" > <head> <title>Titre de la page</title> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> </head> <body> <!-- Ici votre site Web --> </body> </html>

Page 9: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML 5 simplification

HTML5 / CSS3 9

<!DOCTYPE html > <html lang="fr" > <head> <title>Titre de la page</title> <meta charset="utf-8" /> </head> <body> <!-- Ici votre site Web --> </body> </html>

Page 10: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 : CSS / JS

XHTML <head> <link rel="stylesheet" type="text/css" href="css/monfichier.css" /> … <script type="text/javascript" src="js/myFile.js" ></script> </head>

HTML5 <head> <link rel="stylesheet" href="css/monfichier.css" /> … <script src="js/myFile.js" ></script> </head>

HTML5 / CSS3 10

Page 11: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Sémantique Entête

<header></header>

Pied de Page <footer></footer>

Navigation <nav></nav>

Zone de regroupement <section></section>

Zone de contenu <article></article>

Zone secondaire <aside></aside>

HTML5 / CSS3 11

Page 12: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 12

<html> <header>

<head> <nav>

<body> <section>

<title> <article>

<link /> <aside>

<meta> <footer>

<script>

Page 13: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Multimédia

Audio <audio controls="controls"> <source src="audio.ogg" type="audio/ogg" /> <source src="audio.mp3" type="audio/mp3" /> <source src="audio.wav" type="audio/wav" /> Ici l'alternative: un lien de téléchargement, un message, etc. </audio>

Vidéo <video controls="controls"> <source src="video.ogv" type="video/ogg" /> <source src="video.mp4" type="video/mp4" /> Ici l'alternative : un lien de téléchargement, un message, etc. </video>

HTML5 / CSS3 13

Page 14: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Multimédia : codecs

HTML5 / CSS3 14

Page 15: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 15

<body> <header>

<head> <nav>

<body> <section>

<title> <article>

<link /> <aside>

<meta> <footer>

<script> <audio>

<video>

<source />

Page 16: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Images

Image <img/>

Regroupement <figure></figure>

Légende <figcaption></figcaption>

HTML5 / CSS3 16

<figure> <img src="/images/chaton.jpg" alt="Oh le beau chaton"/> <figcaption>Un petit chat mignon tout plein</figcaption> </figure>

Page 17: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 17

<body> <header>

<head> <nav>

<body> <section>

<title> <article>

<link /> <aside>

<meta> <footer>

<script> <audio>

<video>

<img/> <source />

<figure>

<figcaption>

Page 18: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Conteneurs

Division <div></div>

Section <section></section>

Article <article></article>

Cadre <iframe></iframe>

HTML5 / CSS3 18

Page 19: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Texte

Paragraphe <p></p>

Saut de ligne <br/>

Titre <h1></h1> … <h6></h6>

Portion de texte <span></span>

Force <strong></strong> Gras <b></b>

Emphase <em></em> Italique <i></i>

Surligné <mark></mark> Souligné <u></u>

HTML5 / CSS3 19

Page 20: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 20

<body> <header> <div>

<head> <nav> <p>

<body> <section> <br/>

<title> <article> <iframe>

<link /> <aside> <span>

<meta> <footer> <hx>

<script> <audio> <strong>

<video> <em>

<img/> <source /> <mark>

<figure> <b>

<figcaption> <i>

<u>

Page 21: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Formulaires

Conteneur <form></form> Méthode d’envoi method

Encodage des données enctype

Cible d’exécution action

Zone de texte <textarea></textarea>

Liste de choix <select></select>, <option></option> Liste à choix multiple multiple="multiple"

Etiquette <label for="id"></label>

HTML5 / CSS3 21

Page 22: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Formulaires

Saisie d’information <input/> Valeur initiale value

Nom de la donnée name

Désactivation disabled

Type de donnée type

Valeurs possibles pour l’attribut type

HTML5 / CSS3 22

image password text url date month

reset checkbox hidden number time week

button file tel color datetime search

submit radio email range datetime-local

Page 23: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 23

image url

reset number

button color

submit range

password date

checkbox time

file datetime

radio datetime-local

text month

hidden week

tel search

email

Page 24: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 24

<body> <header> <form> <div>

<head> <nav> <textarea> <p>

<body> <section> <select> <br/>

<title> <article> <option> <iframe>

<link /> <aside> <input /> <span>

<meta> <footer> <label> <hx>

<script> <audio> <strong>

<video> <em>

<img/> <source /> <mark>

<figure> <b>

<figcaption> <i>

Page 25: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Listes

Liste non ordonnées <ul></ul>

Liste ordonnée <ol></ol>

Élément de liste <li></li>

Liste de termes <dl></dl>

HTML5 / CSS3 25

<ul> <li>1er élément de la liste</li> <li>2ème élément de la liste</li> </ul>

<dl> <dt>Terme 1</dt> <dd>Définition du terme 1</dd> <dt>Terme 2</dt> <dd>Définition du terme 2</dd> </dl>

Page 26: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 26

<body> <header> <form> <div> <ul>

<head> <nav> <textarea> <p> <ol>

<body> <section> <select> <br/> <li>

<title> <article> <option> <iframe> <dl>

<link /> <aside> <input /> <span> <dt>

<meta> <footer> <label> <hx> <dd>

<script> <audio> <strong>

<video> <em>

<img/> <source /> <mark>

<figure> <b>

<figcaption> <i>

<u>

Page 27: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Tableaux

Conteneur <table></table>

Ligne <tr></tr>

Cellule <td></td>

HTML5 / CSS3 27

<table border="1"> <tr> <td>Cellule 1 de la ligne 1</td> <td>Cellule 2 de la ligne 1</td> <td>Cellule 3 de la ligne 1</td> </tr> <tr> <td colspan="2">Cellule 1 de la ligne 2</td> <td rowspan="2">Cellule 2 de la ligne 2</td> </tr> <tr> <td>Cellule 1 de la ligne 3</td> <td>Cellule 2 de la ligne 3</td> </tr> </table>

Page 28: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Tableaux

Légende <caption></caption>

Titre <th></th>

Entete <thead></thead>

Corps <tbody></tbody>

Pied <tfoot></tfoot>

HTML5 / CSS3 28

<table border="1"> <caption>Legende</caption> <thead> <tr> <th>Titre 1</th> <th>Titre 1</th> </tr> </thead> <tfoot> <tr> <td>Pied 1</td> <td>Pied 2</td> </tr> </tfoot> <tbody> <tr> <td>Case 1</td> <td>Case 2</td> </tr> </tbody> </table>

Page 29: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 29

<body> <header> <form> <div> <ul> <table>

<head> <nav> <textarea> <p> <ol> <thead>

<body> <section> <select> <br/> <li> <tbody>

<title> <article> <option> <iframe> <dl> <tfoot>

<link /> <aside> <input /> <span> <dt> <tr>

<meta> <footer> <label> <hx> <dd> <td>

<script> <audio> <strong> <th>

<video> <em> <caption>

<img/> <source /> <mark>

<figure> <b>

<figcaption> <i>

<u>

Page 30: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Liens

Lien hypertexte <a></a> Lien <a href="http://www.domain.com" title="Explication du lien">Texte cliquable</a>

<a href="page.html" title="Explication du lien">Texte cliquable</a>

Ancrage <a href="#unique-id-1">Lien interne vers l'ancre locale unique-id-1</a> <a href="http://www.domain.com#unique-id-2">Lien interne vers l'ancre unique-id-2 de l'adresse www.domain.com</a> <a href="mailto:[email protected]">Ecrivez-moi</a>

HTML5 / CSS3 30

Page 31: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 31

<body> <header> <form> <div> <ul> <table>

<head> <nav> <textarea> <p> <ol> <thead>

<body> <section> <select> <br/> <li> <tbody>

<title> <article> <option> <iframe> <dl> <tfoot>

<link /> <aside> <input /> <span> <dt> <tr>

<meta> <footer> <label> <hx> <dd> <td>

<script> <audio> <strong> <th>

<a> <video> <em> <caption>

<img/> <source /> <mark>

<figure> <b>

<figcaption> <i>

<u>

Page 32: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Problème de Norme

HTML5 / CSS3 32

Page 33: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

CSS : bases

HTML5 / CSS3 33

sélecteur { propriété1: valeur; propriété2: valeur; }

div a { color: #CCCCCC; font-size: 27px; }

Page 34: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Simple : nom d’une balise h1 {

color: black; /* met les titres h1 en noir */

}

Multiple : plusieurs balises séparées par , h1, h2, h3, h4, h5, h6 {

color: red; /* met l’ensemble des titres en rouge */

}

Contextuel : plusieurs sélecteurs h1 em {

color: blue; /* met les mots en emphase à l’intérieur d’un h1 en bleu */

}

HTML5 / CSS3 34

Sélecteur

Page 35: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Pseudo-classe a:visited {

color: red; /* les a qui sont des liens déjà cliqués sont en rouge*/

}

Liste complète :

http://www.w3schools.com/css/css_pseudo_classes.asp

HTML5 / CSS3 35

Sélecteur

Page 36: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Classe .person {

font-weight: bold;

}

Identifiant #monster {

color: green;

}

HTML5 / CSS3 36

Sélecteur

<div class="person"> <p>John Smith</p> </div> <p>John <span class="person">Doe</span></p>

<div id="monster"> <p>Shrek</p> </div>

Page 37: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

1. !important .person {

font-weight: bold !important;

}

2. Poids des sélécteurs, le plus spécifique est prioritaire

3. Dernière arrivée

Attention, les règles se transmettent aussi au

contenu (s’ils peuvent en hériter)

HTML5 / CSS3 37

Résolution des conflits

Page 38: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 38

color

font-size

font-weight

Page 39: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

text-decoration none, underline, overline, line-through

text-align left, center, right, justify

vertical-align super, baseline, sub

text-indent

letter-spacing

HTML5 / CSS3 39

Propriétés textuelles

Page 40: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

font, toutes les propriétés suivante sur 1 ligne

font-family, famille de police

font-size, taille des lettres

font-style normal, italic, oblique, initial, inherit

font-variant normal, small-caps, initial, inherit

font-weight normal, bold, bolder, lighter, 100-900,

initial, inherit

@font-face, police non standard

HTML5 / CSS3 40

Polices de caractère

Page 41: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Empattement : serif font-family: "Times New Roman", Times, "Liberation Serif", FreeSerif, serif; font-family: Georgia, "DejaVu Serif", Norasi, serif;

Sans empattement : sans-serif font-family: Arial, Helvetica, "Liberation Sans", FreeSans, sans-serif; font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; font-family: "Lucida Sans", "Lucida Grande", "Lucida Sans Unicode", "Luxi Sans", sans-serif; font-family: Tahoma, Geneva, Kalimati, sans-serif; font-family: Verdana, "DejaVu Sans", "Bitstream Vera Sans", Geneva, sans-serif; font-family: Impact, "Arial Black", sans-serif;

Chasse fixe : monospace font-family: "Courier New", Courier, "Liberation Mono", monospace; font-family: Monaco, "DejaVu Sans Mono", "Lucida Console", "Andale Mono", monospace;

Autres : cursive, fantasy

HTML5 / CSS3 41

Familles de Polices

Page 42: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 42

font-face

@font-face { font-family: nomDePoliceVoulu; src: url(sansation_light.woff); } div { font-family: nomDePoliceVoulu; }

Page 43: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Absolues : px, mm, cm…

Relatives : em, small, medium, large…

Pourcentage : %

HTML5 / CSS3 43

Unité de taille

Page 44: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 44

color text-decoration

text-align

font text-indent

font-face letter-spacing

font-family vertical-align

font-size

font-style

font-variant

font-weight

Page 45: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Largeur : width Minimum : min-width

Maximum : max-width

Hauteur : height Minimum : min-height

Maximum : max-height

Débordement : overflow visible, hidden, scroll, auto

HTML5 / CSS3 45

Dimension

Page 46: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 46

color text-decoration width

text-align min-width

font text-indent max-width

font-face letter-spacing height

font-family vertical-align min-height

font-size max-height

font-style overflow

font-variant

font-weight

Page 47: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

border

border-width

border-style (obligatoire)

border-color

border-top

border-right

border-bottom

border-left

HTML5 / CSS3 47

Bordure

Page 48: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Bordures : border-collapse (collapse,

separate)

Espacement entre les bordures : border-spacing

Cellules vides : empty-cells (show, hide)

Alignement vertical : vertical-align (top,

middle, bottom)

HTML5 / CSS3 48

Tableaux

Page 49: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

border-radius longueur %

border-top-left-radius

border-top-right-radius

border-bottom-right-radius

border-bottom-left-radius

HTML5 / CSS3 49

Bordures Arrondies

Page 50: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 50

color text-decoration width

text-align min-width

font text-indent max-width

font-face letter-spacing height

font-family vertical-align min-height

font-size border max-height

font-style border-width overflow border-collapse

font-variant border-style border-spacing

font-weight border-color empty-cells

border-top

border-right

border-bottom

border-left

border-radius

Page 51: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

position

static (par défaut)

absolute

relative

fixed (suis le défilement)

HTML5 / CSS3 51

Positionnement

top

bottom

left right

Page 52: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 52

color text-decoration width

text-align min-width

font text-indent max-width

font-face letter-spacing height

font-family vertical-align min-height

font-size border max-height

font-style border-width overflow border-collapse

font-variant border-style border-spacing

font-weight border-color empty-cells

position border-top

top border-right

bottom border-bottom

left border-left

right border-radius

Page 53: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

visibility (hidden, visible)

display (none, block, inline, list-item)

Profondeur : z-index

Flottement : float (none, left, right)

Dégagement : clear (none, left, right, both)

HTML5 / CSS3 53

Positionnement / Flottement

Page 54: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 54

color text-decoration width

text-align min-width

font text-indent max-width

font-face letter-spacing height

font-family vertical-align min-height

font-size border max-height

font-style border-width overflow border-collapse

font-variant border-style visibility border-spacing

font-weight border-color display empty-cells

position border-top z-index

top border-right float

bottom border-bottom clear

left border-left

right border-radius

Page 55: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

margin

margin-top

margin-right

margin-bottom

margin-left

HTML5 / CSS3 55

Marges

padding

padding-top

padding-right

padding-bottom

padding-left

margin = marge externe

border = bordure

padding = marge interne

Contenu

Page 56: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 56

color text-decoration width

text-align min-width

font text-indent max-width

font-face letter-spacing height

font-family vertical-align min-height

font-size border max-height

font-style border-width overflow border-collapse

font-variant border-style visibility border-spacing

font-weight border-color display empty-cells

position border-top z-index

top border-right float

bottom border-bottom clear

left border-left margin

right border-radius padding

Page 57: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

background

background-color

background-image

background-repeat

background-attachment

background-position

background-size

HTML5 / CSS3 57

Fond

Page 58: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Littérale : white, black, green…

Hexadécimale : #47B247

RGB : rgb (71, 178, 71)

RGBA : rgba (71, 178, 71, 0,3)

HSL : hsl (120, 60%, 70%)

HSLA : hsla (120, 60%, 70%, 0.3)

HTML5 / CSS3 58

Couleurs

Page 59: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Exprimée en pourcentage

Opacité : opacity: 0,4

Pour IE avant 9 : filter: alpha(opacity=40)

Sur RGBA et HSLA, le dernier paramètre est

aussi l’opacité

HTML5 / CSS3 59

Opacité

Page 60: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Linéaire : linear-gradient

Linéaire répété : repeating-linear-gradient

Circulaire : radial-gradient

Direction

Couleur x { %}

HTML5 / CSS3 60

Gradients de couleurs

left left top ellipse closest-side

right to top right circle farthest-side

Top to right x% y% closest-corner

bottom ydeg farthest-corner

Page 61: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 61

color text-decoration width background

opacity text-align min-width background-color

font text-indent max-width background-image

font-face letter-spacing height background-repeat

font-family vertical-align min-height background-attachment

font-size border max-height background-position

font-style border-width overflow border-collapse

font-variant border-style visibility border-spacing

font-weight border-color display empty-cells

position border-top z-index

top border-right float

bottom border-bottom clear

left border-left margin

right border-radius padding

Page 62: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

list-style-image

list-style-position

list-style-type none, disc, circle, square,

decimal, upper-alpha, lower-alpha, upper-roman, lower-roman

HTML5 / CSS3 62

Propriétés de liste

Page 63: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 63

color text-decoration width background

opacity text-align min-width background-color

font text-indent max-width background-image

font-face letter-spacing height background-repeat

font-family vertical-align min-height background-attachment

font-size border max-height background-position

font-style border-width overflow border-collapse

font-variant border-style visibility border-spacing

font-weight border-color display empty-cells

position border-top z-index

top border-right float

bottom border-bottom clear

left border-left margin

right border-radius padding

Page 64: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Texte : text-shadow

Conteneur : box-shadow

Horizontal

Vertical

Flou (defaut : 0)

Couleur / none / initial / inherit

HTML5 / CSS3 64

Ombres

Page 65: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 65

color text-decoration width background

opacity text-align min-width background-color

font text-indent max-width background-image

font-face letter-spacing height background-repeat

font-family vertical-align min-height background-attachment

font-size border max-height background-position

font-style border-width overflow border-collapse

font-variant border-style visibility border-spacing

font-weight border-color display empty-cells

position border-top z-index text-shadow

top border-right float box-shadow

bottom border-bottom clear

left border-left margin

right border-radius padding

Page 66: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

transition

HTML5 / CSS3 66

Transitions

div { width: 100px; height: 100px; background: red; -webkit-transition: width 2s; transition: width 2s; } div:hover { width: 300px; }

Page 67: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 67

color text-decoration width background

opacity text-align min-width background-color

font text-indent max-width background-image

font-face letter-spacing height background-repeat

font-family vertical-align min-height background-attachment

font-size border max-height background-position

font-style border-width overflow border-collapse

font-variant border-style visibility border-spacing

font-weight border-color display empty-cells

position border-top z-index text-shadow

top border-right float box-shadow

bottom border-bottom clear transition

left border-left margin

right border-radius padding

Page 68: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

transform

HTML5 / CSS3 68

Transformations

none skew perspective

matrix skewX initial

matrix3d skewY inherit

translate scale rotate

translate3d scale3d rotate3d

translateX scaleX rotateX

translateY scaleY rotateY

translateZ scaleZ rotateZ

Page 69: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 69

color text-decoration width background

opacity text-align min-width background-color

font text-indent max-width background-image

font-face letter-spacing height background-repeat

font-family vertical-align min-height background-attachment

font-size border max-height background-position

font-style border-width overflow border-collapse

font-variant border-style visibility border-spacing

font-weight border-color display empty-cells

position border-top z-index text-shadow

top border-right float box-shadow

bottom border-bottom clear transition

left border-left margin transform

right border-radius padding

Page 70: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Précision d’un sélecteur

Cas particulier d’utilisation

Pourrait être remplacé par une classe

Accolé au sélecteur grave à un :

:lang() En fonction de l’attribut lang

:first-child

HTML5 / CSS3 70

Pseudo classe

Page 71: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Lien « au repos » : a:link

Au survol : a:hover

Au (moment du) clic : a:active

Lien sélectionné : a:focus

Lien déjà visité : a:visited

HTML5 / CSS3 71

Liens

Page 72: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 72

Classes

:lang :first-child :first-of-type

:link :last-child :last-of-type

:hover :nth-child(N) :only-of-type

:active :nth-last-child(N) :valid

:focus :nth-of-type(N) :invalid

:visited :nth-last-of-type(N) :enabled

:empty :only-child :disabled

:target :root :checked

:not(selector) :required

Page 73: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Elément ajouté à la volée

::before

::after

Eléments non sélectionnables

::first-letter

::first-line

::selection

HTML5 / CSS3 73

Pseudo éléments

Page 74: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 74

Classes Eléments

:lang :first-child :first-of-type ::before

:link :last-child :last-of-type ::after

:hover :nth-child(N) :only-of-type ::first-letter

:active :nth-last-child(N) :valid ::first-line

:focus :nth-of-type(N) :invalid ::selection

:visited :nth-last-of-type(N) :enabled

:empty :only-child :disabled

:target :root :checked

:not(selector) :required

Page 75: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Basé sur la balise link : <link rel="stylesheet" media="screen" href="screen.css" type="text/css" />

Basé sur la feuille de style :

HTML5 / CSS3 75

Media Queries CSS2

screen handheld braille projection tv

print aural / speech embossed tty all

@media print { body { font-size:120%; color:black; } }

Page 76: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Expression toujours vraie ou fausse

Opérateurs logiques and, only, not et ,

Basé sur la balise link : <link rel="stylesheet" media="screen and (max-width: 640px)" href="PetitEcran.css" type="text/css" />

Basé sur la feuille de style :

HTML5 / CSS3 76

Media Queries CSS3

@media screen and (max-width: 640px) { .bloc { display:block; clear:both; } }

Page 77: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Minimum : min-

Maximum : max-

Raccourci : (color) == (min-color: 1)

monochrome est un booléen et un nombre de

niveaux de gris

HTML5 / CSS3 77

Media Queries CSS3 color aspect-ratio grid monochrome

color-index device-aspect-ratio scan ( progressive / interlace )

height device-height orientation ( portrait / landscape )

width device-width resolution (en dpi, dppx ou dpcm)

Page 78: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Principe similaire à une socket

Informations HTML5

Utilisation JavaScript

HTML5 / CSS3 78

WebSockets

var ws = new WebSocket("ws://echo.websocket.org"); ws.onopen = function(evt) { console.log("Connection open ..."); }; ws.onclose = function(evt) { console.log("Connection closed."); }; ws.onerror = function(evt) { console.log("WebSocket error : " + evt.data) }; ws.onmessage = function(evt) { console.log( "Received Message: " + evt.data); };

Page 79: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Conteneur de dessin

Fonctionnalité HTML5

Remplissage par JavaScript

HTML5 / CSS3 79

Canvas

<canvas id="c1" width="200" height="100" style="border:1px solid #000000;" ></canvas>

Page 80: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Début de dessin : beginPath ()

Fin de dessin : closePath ()

Positionnement du curseur : moveTo ()

Tracé d’un trait : stroke ()

Remplissage d’une forme : fill ()

Ecriture de texte : fillText() / strokeText()

HTML5 / CSS3 80

Canvas - Dessin

Page 81: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Dessin d’une ligne : lineTo()

Largeur d’une ligne : lineWidth

Couleur d’une ligne : strokeStyle

Fin de ligne : lineCap ( butt, round, square )

Jonction de lignes : lineJoin

HTML5 / CSS3 81

Canvas - Lignes

Page 82: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Dessin d’un arc : arc() / arcTo ()

Courbe Quadratique : quadraticCurveTo ()

Courbe de Bézier : bezierCurveTo ()

Rectangle : rect ()

HTML5 / CSS3 82

Canvas - Formes

Page 83: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Remplissage : fill ()

Couleur de Remplissage : fillStyle

Gradient Linéaire : createLinearGradient ()

Gradient Circulaire : createRadialGradient ()

Patron : pattern ()

HTML5 / CSS3 83

Canvas - Remplissage

Page 84: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 84

Canvas – Exercice 1

Page 85: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 85

Canvas – Exercice 2

Page 86: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 86

Canvas – Exercice 3

Page 87: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Ecriture de texte (plein) : fillText()

Ecriture de texte (contour) : strokeText()

Police de caractères : font Contient police, taille et style

Alignement (horizontal) : textAlign ()

Alignement (vertical) : textBaseline ()

Coupure de ligne : wrapText ()

Informations : measureText ()

HTML5 / CSS3 87

Canvas - Texte

Page 88: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Remplissage avec une image : drawImage()

Paramètres variables :

Coordonnées

Coordonnées + Tailles (X et Y)

Coordonnées + Tailles (X et Y) dans image d’origine + Coordonnées + Tailles (X et Y) dans

image finale

Attention, l’image doit être chargée

avant d’être utilisée ( callback ou onload )

HTML5 / CSS3 88

Canvas - Images

Page 89: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

HTML5 / CSS3 89

Canvas – Exercice 4

Page 90: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Translation : translate()

Rotation : rotate()

Transformation : transform()

Redimensionnement : scale ()

Reset : setTransform(1,0,0,1,0,0)

Mémorisation : save () / restore ()

HTML5 / CSS3 90

Canvas - Transformations

Page 91: Initiation au Web Statiquechristophe.delagarde.free.fr/Formation/HTML5-CSS3.pdf · 52 HTML5 / CSS3 color text-decoration width text-align min-width font text-indent max-width font-face

Crédits

Auteur Christophe Delagarde

Sources Mickaël Martin Nevot ( www.mickael-martin-nevot.com )

w3schools ( http://www.w3schools.com/ )

HTML5 Canvas Tutorial (http://www.html5canvastutorials.com/)

HTML5 / CSS3 91