SlideShare uma empresa Scribd logo
1 de 65
Baixar para ler offline
FLEXBOX
1
CONTENT-DRIVEN
LAYOUTS WITH
CHRIS
SAUVE
2
LAYOUT
STRATEGIES
3
ABSOLUTE
POSITIONING
4
INLINE BLOCK
5
FLOATS
6
THINK
DIFFERENT
7
CONTENT-OUT
LAYOUT
8
BROWSER
SUPPORT
9
YES YESYES10+ only
-ms	in	IE10
YES
even	in	Mini!
10
YES YESYES10+ only
-ms	in	IE10
YES
even	in	Mini!
CAN I USE SAYS…
95.44%
11
PARENT
RULES
12
display:	flex;	//	or	inline-flex
flex-direction:	row;	//	or	column
13
1 2 3
flex-direction:	row;
14
1
2
3
flex-direction:	column;
15
display:	flex;	//	or	inline-flex
flex-direction:	row;	//	or	column
16
display:	flex;	//	or	inline-flex
flex-direction:	row;	//	or	column
justify-content:	center;
17
1 2 3
Main Axis
justify-content
18
1 2 3
justify-content:	center;
19
1 2 3
justify-content:	flex-start;
20
1 2 3
justify-content:	flex-end;
21
1 2 3
justify-content:	space-between;
22
1 2 3
justify-content:	space-around;
23
display:	flex;	//	or	inline-flex
flex-direction:	row;	//	or	column
justify-content:	center;
24
display:	flex;	//	or	inline-flex
flex-direction:	row;	//	or	column
justify-content:	center;
align-items:	stretch;
25
1 2 3
Cross Axis
align-items
26
1 2 3
align-items:	stretch;	//	default
27
1 2 3
align-items:	center;
28
1 2 3
align-items:	flex-start;
29
1 2 3
align-items:	flex-end;
30
display:	flex;	//	or	inline-flex
flex-direction:	row;	//	or	column
align-items:	stretch;
justify-content:	center;
31
display:	flex;	//	or	inline-flex
flex-direction:	row;	//	or	column
align-items:	stretch;
justify-content:	center;
flex-wrap:	nowrap;
32
1 2 3
flex-wrap:	nowrap;
33
1 2
3
flex-wrap:	wrap;
34
CHILD
RULES
35
flex-grow:	0;
flex-shrink:	0;
flex-basis:	auto;
36
flex:	<grow>	<shrink>	<basis>;
//	or
flex-basis:	<length>;
flex-basis:	auto;
width:	<length>;
37
//	roughly	equivalent	to:
1 2 3
100px
20px 20px 20px
38
1 2 3
100px
20px 20px 20px
40px of “growth” available
39
1 2 3
flex-grow:	0; flex-grow:	0; flex-grow:	0;
40
1 2 3
flex-grow:	1;
13px of growth
flex-grow:	1;
13px of growth
flex-grow:	1;
13px of growth
41
1 2 3
flex-grow:	1;
10px of growth
flex-grow:	2;
20px of growth
flex-grow:	1;
10px of growth
42
1 2 3
flex-grow:	0;
0px of growth
flex-grow:	1;
20px of growth
flex-grow:	1;
20px of growth
43
1 2 3
40px
20px 20px 20px
44
1 2 3
40px
20px 20px 20px
20px of “shrink” available
45
flex-shrink:	0; flex-shrink:	0; flex-shrink:	0;
1 2 3
46
flex-shrink:	0; flex-shrink:	1; flex-shrink:	1;
1
0px of shrink 10px of shrink 10px of shrink
47
NO SILVER
BULLET
48
AWESOME
EXAMPLES
49
PAGE
LAYOUT
50
Play with the Codepen
codepen.io/lemonmade/pen/RNEpJR?editors=110
GOAL
51
52
Header
ContentSidebar
Footer
GOAL
SMART
POPOVERS
53
Play with the Codepen
codepen.io/lemonmade/pen/XJobem?editors=110
54
55
WRAPPABLE
LAYOUTS
Play with the Codepen
codepen.io/lemonmade/pen/XXWZBr?editors=110
56
REFLOWING
HEADER
57
Play with the Codepen
codepen.io/lemonmade/pen/ZYgNmy?editors=110
58
https://css-tricks.com/snippets/css/a-guide-to-flexbox/
CSS-TRICKS
REFERENCE
59
AUTOPREFIXER
https://github.com/philipwalton/flexbugs
60
FLEXBUGS
https://github.com/philipwalton/flexbugs
61
FLEXBOXFROGGY
http://flexboxfroggy.com
62
CHRIS
SAUVE
@_lemonmade
63
SHOPIFY
shopify.com/careers
64
THANKS
EVERYONE!
65

Mais conteúdo relacionado

Destaque

Utter failures and lessons remained unlearned
Utter failures and lessons remained unlearnedUtter failures and lessons remained unlearned
Utter failures and lessons remained unlearned
Ilari Henrik Aegerter
 

Destaque (12)

Exploring ideas
Exploring ideasExploring ideas
Exploring ideas
 
Paper - "Esperienza utente e fruizione dei contenuti nei quotidiani online i...
Paper - "Esperienza utente e fruizione dei contenuti nei  quotidiani online i...Paper - "Esperienza utente e fruizione dei contenuti nei  quotidiani online i...
Paper - "Esperienza utente e fruizione dei contenuti nei quotidiani online i...
 
Adaptive, Responsive, Mobile. A liquid web.
Adaptive, Responsive, Mobile. A liquid web.Adaptive, Responsive, Mobile. A liquid web.
Adaptive, Responsive, Mobile. A liquid web.
 
Mobile last
Mobile lastMobile last
Mobile last
 
What future we want for our Software Industry?
What future we want for our Software Industry?What future we want for our Software Industry?
What future we want for our Software Industry?
 
Style Guides, Pattern Libraries, Design Systems and other amenities.
 Style Guides, Pattern Libraries, Design Systems and other amenities. Style Guides, Pattern Libraries, Design Systems and other amenities.
Style Guides, Pattern Libraries, Design Systems and other amenities.
 
Understanding flexbox
Understanding flexboxUnderstanding flexbox
Understanding flexbox
 
Interface Fundamentals
Interface FundamentalsInterface Fundamentals
Interface Fundamentals
 
Utter failures and lessons remained unlearned
Utter failures and lessons remained unlearnedUtter failures and lessons remained unlearned
Utter failures and lessons remained unlearned
 
DevOps in PHP environment
DevOps in PHP environmentDevOps in PHP environment
DevOps in PHP environment
 
Information Architecture Fundamentals
Information Architecture FundamentalsInformation Architecture Fundamentals
Information Architecture Fundamentals
 
The Mission of the Coalition of Residential Excellence
The Mission of the Coalition of Residential Excellence The Mission of the Coalition of Residential Excellence
The Mission of the Coalition of Residential Excellence
 

Último

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Último (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

Content-Driven Layouts with Flexbox (Chris Sauve, CSSDay 2015)