with flexbox by: mario hernandez advanced layouts · advanced layouts with flexbox by: mario...

44
Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

Upload: truongdien

Post on 20-Sep-2018

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

Advanced Layouts with Flexbox

By: Mario Hernandez

Date

DrupalCon 2015 Los Angeles May 14th, 2015

Page 2: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

Mario HernandezFront-End Developer

@DesignsDrive

DrupalCon 2015 Los Angeles May 14th, 2015

Page 3: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

Development● Drupal Support

● Custom Module Development

● Large Scale Systems Integration

● Security & Performance Expertise

Design/Theming● Usability Testing

● Responsive Design

● Drupal Theming

● Annotated Wireframes

@Mediacurrent

We help organizations build highly impactful, elegantly designed Drupal websites that achieve the strategic results you need.

Digital Strategy● Content Strategy

● Content Generation

● Result Metrics

● Marketing Automation Integration

Page 4: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

● What Are the Problems?● The Flexbox Way● So What is Flexbox?● Browser Support● Getting to Know Flexbox● Practical Use Cases● Fallbacks● Resources

Agenda

@Mediacurrent

Page 5: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

What are the problems with float layouts?

@Mediacurrent

Page 6: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

What are the problems with float layouts?● Difficulty with containment

@Mediacurrent

Page 7: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

What are the problems with float layouts?● Difficulty with containment● Source order dependent

@Mediacurrent

Page 8: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

What are the problems with float layouts?● Difficulty with containment● Source order dependent● Difficulty with equal-height columns

@Mediacurrent

Page 9: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

What are the problems with float layouts?● Difficulty with containment● Source order dependent● Difficulty with equal-height columns● No float:center

@Mediacurrent

Page 10: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

What are the problems with float layouts?● Difficulty with containment● Source order dependent● Difficulty with equal-height columns● No float:center● No vertical center

@Mediacurrent

Page 11: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

@Mediacurrent

How does Flexbox solve these issues?

Page 13: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

@Mediacurrent

The Flexbox Way● Makes flex items grow to fill available space or

shrink to avoid overflow

Page 14: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

@Mediacurrent

The Flexbox Way● Makes flex items grow to fill available space or

shrink to avoid overflow● Gives flex items proportional dimensions

Page 15: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

@Mediacurrent

The Flexbox Way● Makes flex items grow to fill available space or

shrink to avoid overflow● Gives flex items proportional dimensions● Lays out flex items in any direction

Page 16: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

@Mediacurrent

The Flexbox Way● Makes flex items grow to fill available space or

shrink to avoid overflow● Gives flex items proportional dimensions● Lays out flex items in any direction● Places flex items in any order independently of

HTML order

Page 17: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

@Mediacurrent

What is Flexbox?Flexbox is The New Black

Page 18: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

@Mediacurrent

What is Flexbox?The defining aspect of the flexbox is the ability to alter its items' width and/or height to best fill the available space on any display device.

Page 19: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

@Mediacurrent

The defining aspect of the flexbox is the ability to alter its items' width and/or height to best fill the available space on any display device.

A flex container expands items to fill available free space, or shrinks them to prevent overflow.

What is Flexbox?

Page 21: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

@Mediacurrent

flex-item flex-item flex-item

flex-container

Page 22: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

@Mediacurrent

flex-item flex-item flex-item

flex-container

main axis

Page 23: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

@Mediacurrent

flex-item flex-item flex-item

flex-container

main axis

cros

s axis

Page 24: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

@Mediacurrent

flex-item flex-item flex-item

flex-container

main axis

cros

s axis

main size

cros

s size

Page 25: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

@Mediacurrent

flex-item flex-item flex-item

flex-container

main axis

cros

s axis

main size

cros

s size

main start main end

Page 26: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

@Mediacurrent

flex-item flex-item flex-item

flex-container

main axis

cros

s axis

main size

cros

s size

cross start

cross endmain start main end

Page 27: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

@Mediacurrent

Learning the Flexbox Properties

Page 28: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

@Mediacurrent

Flexbox Propertiesflex-direction

flex-wrap

flex-flow

justify-content

align-items

align-content

Page 29: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

@Mediacurrent

Flexbox Propertiesflex-direction

flex-wrap

flex-flow

justify-content

align-items

align-content

order

align-self

flex-grow

flex-shrink

flex-basis

flex

Page 30: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

@Mediacurrent

Flexbox Propertiesflex-direction

flex-wrap

flex-flow

justify-content

align-items

align-content

order

align-self

flex-grow

flex-shrink

flex-basis

flex

flex container flex item

Page 31: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

@Mediacurrent

UsageTo use flexbox layout just set the display property on the parent HTML element:

Page 32: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015

@Mediacurrent

UsageTo use flexbox layout just set the display property on the parent HTML element:

Page 35: with Flexbox By: Mario Hernandez Advanced Layouts · Advanced Layouts with Flexbox By: Mario Hernandez Date DrupalCon 2015 Los Angeles May 14th, 2015