SlideShare une entreprise Scribd logo
Responsive design
1. Responsive ?
Définition 
Le Responsive Web design est une approche de conception 
Web qui vise à l'élaboration de sites offrant une 
expérience de lecture et de navigation optimales pour 
l'utilisateur quelle que soit sa gamme d’appareil. 
http://www.alsacreations.com
Gamme d’appareil ? (1)
Gamme d’appareil ? (2)
Gamme d’appareil ? (3)
Un site pour chaque device ?
Responsive webdesign, here we are ! 
Source : http://mediaqueri.es
Quelles technologies ? 
Grilles fluides 
- 
Media queries 
- 
Images flexibles 
- 
Typographie responsive
2. Grilles fluides
Relative units 
VS 
Fixed units
Fixed units - exemple 
#wrapper 
#header 
#sidebar #content 
#wrapper{ 
width: 960px; 
} 
#header{ 
width: 960px; 
} 
#sidebar{ 
width: 300px; 
margin-right: 20px; 
} 
#content{ 
width: 640px; 
}
Relative or fixed ? 
Pixels 
Points 
Pourcentage 
Em
Relative units - exemple 
#wrapper 
#header 
#sidebar #content 
#wrapper{ 
width: 100%; 
} 
#header{ 
width: 100%; 
} 
#sidebar{ 
width: 31.25%; 
margin-right: 2.08334%; 
} 
#content{ 
width: 66.66667%; 
}
Grille fluide 
25% 25% 25% 25% 
33% 33% 33% 
50% 50% 
100%
4. Images flexibles
Défault 
Images are not 
naturally fluid.
Solution : relative units 
img{ 
max-width:100%; 
height:auto; 
} 
L’image s’affichera à sa taille normal sauf si 
elle est plus large que son parent. Dans ce 
cas elle prendra la largeur de son parent.
Et pour les background ? 
img{ 
background: url('test.jpg') no-repeat 50% 50%; 
-webkit-background-size: cover; /* Chrome & Safari */ 
-moz-background-size: cover; /* Firefox */ 
-o-background-size: cover; /* Opera */ 
background-size: cover; 
} 
La taille de l’image s’adapte au conteneur en 
centrant verticalement et horizontalement.
3. Media queries
Définition 
Une media query est une expression dont la valeur est 
toujours true ou false. Il suffit d'associer les différentes 
déclarations possibles avec un opérateur logique pour 
définir l'ensemble des conditions à réunir pour l'application 
des styles compris dans le bloc adjacent. 
http://www.alsacreations.com
Types de média (css2) 
screen - handheld - print - speech - 
braille - embossed - projection - tv
Propriétés du device (css3) 
color - color-index - device-aspect-ratio 
- aspect-ratio - device-height -device-width 
- grid - height - monochrome - 
orientation - resolution - scan - width
Propriétés du device (css3) 
color - color-index - device-aspect-ratio 
- aspect-ratio - device-height -device-width 
- grid - height - monochrome - 
orientation - resolution - scan - width
Opérateurs logiques (css3) 
and - only - not
Exemples 
screen and (max-width: 640px) 
- 
only print 
- 
screen and (orientation: landscape) 
- 
not screen and (max-device-width: 480px)
Media query dans le head 
<!DOCTYPE html> 
<html> 
<head> 
... 
<link rel="stylesheet" media="screen" href="screen_style.css" type="text/css" /> 
<link rel="stylesheet" media="print" href="print_style.css" type="text/css" /> 
... 
</head> 
<body></body> 
</html>
Media query dans le css 
@media screen and (max-width: 640px) { 
h1{ 
color: red; 
} 
p{ 
color: blue; 
} 
} 
h1{ 
color: green; 
}
3. Typographie responsive
CSS Viewport Units 
The viewport-percentage lengths are relative to the size of 
the initial containing block. When the height or width of the 
initial containing block is changed, they are scaled accordingly. 
1vw = Equal to 1% of the width of the initial containing block. 
1vh = Equal to 1% of the height of the initial containing block. 
1vmin = Equal to the smaller of ‘vw’ or ‘vh’ 
1vmax = Equal to the larger of ‘vw’ or ‘vh’. 
http://www.w3.org/TR/css3-values/
Media Queries & em 
body { 
font-size: 100%; 
} 
h1 { 
font-size: 2.5em; 
} 
@media screen and (max-width: 50em) { 
h1 { 
font-size:2em; 
} 
} 
@media screen and (max-width: 40em) { 
h1 { 
font-size:1.5em; 
} 
}
Merci pour votre attention.
Bibliographie 
The 2014 Guide to Responsive Web Design - Nick Pettit 
http://blog.teamtreehouse.com/modern-field-guide-responsive-web-design 
Using CSS Background-size Responsively - Kean Richmond 
http://www.onextrapixel.com/2012/03/02/using-css-background-size-responsively/ 
Les Media Queries CSS3 - dew (Alsacréations) 
http://www.alsacreations.com/article/lire/930-css3-media-queries.html 
Techniques for Responsive Typography - Sara Soueidan 
http://tympanus.net/codrops/2013/11/19/techniques-for-responsive-typography/ 
Pragmatic responsive design - yiibu 
http://fr.slideshare.net/yiibu/pragmatic-responsive-design 
Responsive Webdesign – présent et futur de l’adaptation mobile - Stéphanie Walter 
http://www.alsacreations.com/article/lire/1559-responsive-web-design-present-futur-adaptation-mobile.html
Crédits 
Loïc Le Meur on Google Glass - Loïc Le Meur 
http://commons.wikimedia.org/wiki/File:A_Google_Glass_wearer.jpg

Contenu connexe

PDF
Architecture logicielle #5 : hipsto framework
PDF
Javascript #4.2 : fonctions for pgm
PDF
Javascript #10 : canvas
PDF
PHP #6 : mysql
PDF
Dev Web 101 #2 : development for dummies
PDF
#1 entreprendre au xxiè siècle
PDF
Javascript #2.2 : jQuery
PDF
Gestion de projet #4 : spécification
Architecture logicielle #5 : hipsto framework
Javascript #4.2 : fonctions for pgm
Javascript #10 : canvas
PHP #6 : mysql
Dev Web 101 #2 : development for dummies
#1 entreprendre au xxiè siècle
Javascript #2.2 : jQuery
Gestion de projet #4 : spécification

En vedette (20)

PDF
#4 css 101
PDF
Javascript #4.1 : fonctions for noobs
PDF
Gestion de projet #3 : besoin client
PDF
Une introduction à Javascript
PDF
Html & Css #6 : formulaires
PDF
Projet timezone
PDF
Javascript #5.1 : tp1 zombies!
PDF
PHP & MYSQL #5 : fonctions
PDF
Html & Css #5 : positionement
PDF
Javascript #11: Space invader
PDF
Wordpress #1 : introduction
PDF
Architecture logicielle #2 : TP timezone
PDF
#3 html in the real world
PDF
Javascript #2 : valeurs, types & opérateurs
PDF
Javascript #8 : événements
PDF
Javascript #9 : barbarian quest
PDF
Wordpress #2 : customisation
PDF
PHP #3 : tableaux & formulaires
PDF
Startup & entrepreneuriat #2.1: disrupt me
PDF
Wordpress #3 : content strategie
#4 css 101
Javascript #4.1 : fonctions for noobs
Gestion de projet #3 : besoin client
Une introduction à Javascript
Html & Css #6 : formulaires
Projet timezone
Javascript #5.1 : tp1 zombies!
PHP & MYSQL #5 : fonctions
Html & Css #5 : positionement
Javascript #11: Space invader
Wordpress #1 : introduction
Architecture logicielle #2 : TP timezone
#3 html in the real world
Javascript #2 : valeurs, types & opérateurs
Javascript #8 : événements
Javascript #9 : barbarian quest
Wordpress #2 : customisation
PHP #3 : tableaux & formulaires
Startup & entrepreneuriat #2.1: disrupt me
Wordpress #3 : content strategie
Publicité

Similaire à WebApp #2 : responsive design (20)

PDF
molka foods
PPTX
HTML5mtl - 2012-02-22 - Responsive Web Design
PPSX
Plasticité2015 technovf
PDF
RWD - Back to Basics par Ruben Pieraerts
PDF
Responsive Web Design : back to basics
PDF
Un site web responsive en une heure
PDF
Les bases du responsive design
PPTX
Les jeudis de la découverte
PPTX
582 agr-li - interface mobile - classe 1
PDF
Le responsive design avec les media queries | Alexis Macé
PDF
Responsive Web Design
PDF
Le futur du Responsive Web Design
PPTX
Responsive Design developper - Alexis Metton.pptx
PDF
Un site mobile en une heure ? Top chrono ! (Barcamp-Bordeaux 2011)
KEY
2012 cyril-wolfangel-responsive design-typo3
PDF
Bien Démarrer avec le Responsive Web Design
PPT
Responsive Web Design - BreizhCamp 2013
PDF
MobiliteaTime #5 : Responsive & Adaptive Design
PDF
Responsive logic - Kiwiparty
PPTX
A la découverte du Responsive Web Design par Mathieu Parisot - Soat
molka foods
HTML5mtl - 2012-02-22 - Responsive Web Design
Plasticité2015 technovf
RWD - Back to Basics par Ruben Pieraerts
Responsive Web Design : back to basics
Un site web responsive en une heure
Les bases du responsive design
Les jeudis de la découverte
582 agr-li - interface mobile - classe 1
Le responsive design avec les media queries | Alexis Macé
Responsive Web Design
Le futur du Responsive Web Design
Responsive Design developper - Alexis Metton.pptx
Un site mobile en une heure ? Top chrono ! (Barcamp-Bordeaux 2011)
2012 cyril-wolfangel-responsive design-typo3
Bien Démarrer avec le Responsive Web Design
Responsive Web Design - BreizhCamp 2013
MobiliteaTime #5 : Responsive & Adaptive Design
Responsive logic - Kiwiparty
A la découverte du Responsive Web Design par Mathieu Parisot - Soat
Publicité

Plus de Jean Michel (15)

PDF
Startup #7 : how to get customers
PDF
HTML & CSS #10 : Bootstrap
PDF
Architecture logicielle #4 : mvc
PDF
Architecture logicielle #3 : object oriented design
PDF
Architecture logicielle #1 : introduction
PDF
PHP #7 : guess who?
PDF
PHP #4 : sessions & cookies
PDF
PHP #2 : variables, conditions & boucles
PDF
PHP #1 : introduction
PDF
Startup #5 : pitch
PDF
WebApp #4 : Consuming REST APIs
PDF
Projet timezone
PDF
WebApp #3 : API
PDF
WebApp #1 : introduction
PDF
Javascript #7 : manipuler le dom
Startup #7 : how to get customers
HTML & CSS #10 : Bootstrap
Architecture logicielle #4 : mvc
Architecture logicielle #3 : object oriented design
Architecture logicielle #1 : introduction
PHP #7 : guess who?
PHP #4 : sessions & cookies
PHP #2 : variables, conditions & boucles
PHP #1 : introduction
Startup #5 : pitch
WebApp #4 : Consuming REST APIs
Projet timezone
WebApp #3 : API
WebApp #1 : introduction
Javascript #7 : manipuler le dom

WebApp #2 : responsive design

  • 3. Définition Le Responsive Web design est une approche de conception Web qui vise à l'élaboration de sites offrant une expérience de lecture et de navigation optimales pour l'utilisateur quelle que soit sa gamme d’appareil. http://www.alsacreations.com
  • 7. Un site pour chaque device ?
  • 8. Responsive webdesign, here we are ! Source : http://mediaqueri.es
  • 9. Quelles technologies ? Grilles fluides - Media queries - Images flexibles - Typographie responsive
  • 11. Relative units VS Fixed units
  • 12. Fixed units - exemple #wrapper #header #sidebar #content #wrapper{ width: 960px; } #header{ width: 960px; } #sidebar{ width: 300px; margin-right: 20px; } #content{ width: 640px; }
  • 13. Relative or fixed ? Pixels Points Pourcentage Em
  • 14. Relative units - exemple #wrapper #header #sidebar #content #wrapper{ width: 100%; } #header{ width: 100%; } #sidebar{ width: 31.25%; margin-right: 2.08334%; } #content{ width: 66.66667%; }
  • 15. Grille fluide 25% 25% 25% 25% 33% 33% 33% 50% 50% 100%
  • 17. Défault Images are not naturally fluid.
  • 18. Solution : relative units img{ max-width:100%; height:auto; } L’image s’affichera à sa taille normal sauf si elle est plus large que son parent. Dans ce cas elle prendra la largeur de son parent.
  • 19. Et pour les background ? img{ background: url('test.jpg') no-repeat 50% 50%; -webkit-background-size: cover; /* Chrome & Safari */ -moz-background-size: cover; /* Firefox */ -o-background-size: cover; /* Opera */ background-size: cover; } La taille de l’image s’adapte au conteneur en centrant verticalement et horizontalement.
  • 21. Définition Une media query est une expression dont la valeur est toujours true ou false. Il suffit d'associer les différentes déclarations possibles avec un opérateur logique pour définir l'ensemble des conditions à réunir pour l'application des styles compris dans le bloc adjacent. http://www.alsacreations.com
  • 22. Types de média (css2) screen - handheld - print - speech - braille - embossed - projection - tv
  • 23. Propriétés du device (css3) color - color-index - device-aspect-ratio - aspect-ratio - device-height -device-width - grid - height - monochrome - orientation - resolution - scan - width
  • 24. Propriétés du device (css3) color - color-index - device-aspect-ratio - aspect-ratio - device-height -device-width - grid - height - monochrome - orientation - resolution - scan - width
  • 25. Opérateurs logiques (css3) and - only - not
  • 26. Exemples screen and (max-width: 640px) - only print - screen and (orientation: landscape) - not screen and (max-device-width: 480px)
  • 27. Media query dans le head <!DOCTYPE html> <html> <head> ... <link rel="stylesheet" media="screen" href="screen_style.css" type="text/css" /> <link rel="stylesheet" media="print" href="print_style.css" type="text/css" /> ... </head> <body></body> </html>
  • 28. Media query dans le css @media screen and (max-width: 640px) { h1{ color: red; } p{ color: blue; } } h1{ color: green; }
  • 30. CSS Viewport Units The viewport-percentage lengths are relative to the size of the initial containing block. When the height or width of the initial containing block is changed, they are scaled accordingly. 1vw = Equal to 1% of the width of the initial containing block. 1vh = Equal to 1% of the height of the initial containing block. 1vmin = Equal to the smaller of ‘vw’ or ‘vh’ 1vmax = Equal to the larger of ‘vw’ or ‘vh’. http://www.w3.org/TR/css3-values/
  • 31. Media Queries & em body { font-size: 100%; } h1 { font-size: 2.5em; } @media screen and (max-width: 50em) { h1 { font-size:2em; } } @media screen and (max-width: 40em) { h1 { font-size:1.5em; } }
  • 32. Merci pour votre attention.
  • 33. Bibliographie The 2014 Guide to Responsive Web Design - Nick Pettit http://blog.teamtreehouse.com/modern-field-guide-responsive-web-design Using CSS Background-size Responsively - Kean Richmond http://www.onextrapixel.com/2012/03/02/using-css-background-size-responsively/ Les Media Queries CSS3 - dew (Alsacréations) http://www.alsacreations.com/article/lire/930-css3-media-queries.html Techniques for Responsive Typography - Sara Soueidan http://tympanus.net/codrops/2013/11/19/techniques-for-responsive-typography/ Pragmatic responsive design - yiibu http://fr.slideshare.net/yiibu/pragmatic-responsive-design Responsive Webdesign – présent et futur de l’adaptation mobile - Stéphanie Walter http://www.alsacreations.com/article/lire/1559-responsive-web-design-present-futur-adaptation-mobile.html
  • 34. Crédits Loïc Le Meur on Google Glass - Loïc Le Meur http://commons.wikimedia.org/wiki/File:A_Google_Glass_wearer.jpg