SlideShare uma empresa Scribd logo
1 de 91
Baixar para ler offline
Laying out
                     The future


Friday, 8 March 13
Find me...
         ✴ cmills@opera.com/cmills@w3.org
         ✴ @chrisdavidmills
         ✴ slideshare.net/chrisdavidmills




Friday, 8 March 13
In the early days
         ✴ We thought the Web was print
         ✴ Limited device landscape meant
           limited outlook
         ✴ Limited toolset




Friday, 8 March 13
Consistent CSS support
         ✴ Was very welcome...
         ✴ Still didn’t give us much in the way
           of layout




Friday, 8 March 13
CSS2 gave us
         ✴ floats: limiting, and kind of abused.
         ✴ positioning: feh.
         ✴ margins, padding: pfffff.
         ✴ borders.
         ✴ meh.




Friday, 8 March 13
We still have problems
        At this point, there was still a raft of
        design problems that were absurdly
        difficult to solve on the web.




Friday, 8 March 13
What about
         ✴ Centering stuff?
         ✴ Same height columns?
         ✴ Flexible multiple columns?
         ✴ Complex floats?
         ✴ Shrinkwrapping contents?
         ✴ etc.



Friday, 8 March 13
Same height columns




Friday, 8 March 13
Same height columns
         ✴ We can fix this with faux columns
         ✴ Or JavaScript
         ✴ But really? Should we need to?




Friday, 8 March 13
Fortunately we have



                     A New Hope


Friday, 8 March 13
New tools on the horizon
         ✴ CSS WG + browser vendors
         ✴ Hard at work




Friday, 8 March 13
Media queries


Friday, 8 March 13
Media queries
         ✴ Same content, different layouts
         ✴ Optimized UIs!
         ✴ Polyfills/fixed layouts for old IE




Friday, 8 March 13
Media queries
        /* Mobile first - make your mobile layout
        the default... */

        @media screen and (min-width: 481px) {
          /* ...then do amazing stuff for
             wider screens */
        }




Friday, 8 March 13
Media queries




Friday, 8 March 13
matchMedia
         ✴ matchMedia = media queries inside
           script
         ✴ For IE<10 and Opera Presto, polyfill
           github.com/paulirish/matchMedia.js/




Friday, 8 March 13
matchMedia example
        if (window.matchMedia("(min-width:
        480px)").matches) {
          /* Do stuff for wider screens */
        } else {
          /* Do stuff for narrow screens */
        }




Friday, 8 March 13
More on Media queries
        http://dev.opera.com/articles/view/
        love-your -devices-adaptive-web-
        design-with-media-queries-viewport-
        and-more/




Friday, 8 March 13
viewport/CSS
                        device
                      adaptation

Friday, 8 March 13
Mobile browsers lie
         ✴ About viewport width
         ✴ Some also lie about the resolution
         ✴ So media queries alone don’t cut it




Friday, 8 March 13
Mobile misbehavior




Friday, 8 March 13
Viewport
        <meta name="viewport"
        content="width=device-width">




Friday, 8 March 13
Better




Friday, 8 March 13
@viewport

         ✴ Because viewport is more of a
           style thing
         ✴ Specify viewport inside the
           @viewport rule
         ✴ Opera Presto, IE10, WebKit




Friday, 8 March 13
Viewport
        @viewport {
          width: device-width;
        }




Friday, 8 March 13
More on viewport
                      and @ viewport
        http://dev.opera.com/articles/view/an-
        introduction-to-meta-viewport-and-
        viewport/




Friday, 8 March 13
Flexbox


Friday, 8 March 13
Flexbox rocks
         ✴ Allows easy flexible layouts
         ✴ Content reordering
         ✴ Same height columns
         ✴ Cure for cancer?
         ✴ Chrome, Opera Presto, FF IE (old
                                     ,
           syntax)



Friday, 8 March 13
An example
        <section>
          <nav> ... </nav>
          <article> ... </article>
          <article> ... </article>
        </section>




Friday, 8 March 13
An example
        section {
          display: flex;
        }




Friday, 8 March 13
Gives you




Friday, 8 March 13
Rows and columns
        section {
          display: flex;
          flex-direction: row;
          flex-wrap: nowrap;
        }

        /* flex-flow is shorthand for flex-direction/
           wrap   */




Friday, 8 March 13
Main and cross axis




Friday, 8 March 13
align items on main axis
        section {
          justify-content: center;
        }

        /* can take other values such as flex-start,
        flex-end, space-between and space-around */




Friday, 8 March 13
Friday, 8 March 13
align items on cross axis
        section {
          align-items: stretch;
        }

        /* can take other values such as flex-start,
        flex-end, and center; */




Friday, 8 March 13
Friday, 8 March 13
Ordering elements
         ✴ Reorder child elements easily and
           quickly
         ✴ Without screwing with the DOM




Friday, 8 March 13
Ordinal groups
        nav {
          order: 1;
        }




Friday, 8 March 13
Gives you




Friday, 8 March 13
Flexing our muscle
         ✴ The flex property
         ✴ Set what proportion of available
           space child elements occupy
         ✴ Unit-less proportion values




Friday, 8 March 13
Flex property
        nav {
          flex: 1;
        }

        article {
          flex: 3;
        }




Friday, 8 March 13
Gives you




Friday, 8 March 13
But there’s more
        article {
          flex: 3 2 400px;
        }

        /* flex-grow shares out positive space
        flex-shrink shares out overflow reduction
        flex-basis initially applied
        = CAN GET BLOODY COMPLICATED */




Friday, 8 March 13
A case study




Friday, 8 March 13
Placing the nav
        section {
          display: flex;
          flex-flow: row wrap;
        }

        nav {
          flex: 1 100%;
        }




Friday, 8 March 13
Flexible awesome nav!




Friday, 8 March 13
Making awesome
        nav {
          display: flex;
          justify-content: center;
        }

        nav ul {
          display: flex;
          flex-flow: row wrap;
          justify-content: center;
          width: 80%;
        }
Friday, 8 March 13
Making awesome
        nav ul li {
          flex: auto;
          min-width: 5rem;
        }




Friday, 8 March 13
More on Flexbox
        http://dev.opera.com/articles/view/
        flexbox-basics/




Friday, 8 March 13
Multi-column


Friday, 8 March 13
Multi-col layouts
         ✴ Break content into multi-col
         ✴ Cut down on markup cruft
         ✴ Specify column breaks, column
           rules and heading span
         ✴ Most modern browsers have this




Friday, 8 March 13
Great at some things
        <article>...</article>

        article {
          column-count: 2;
          column-gap: 1rem;
          column-rule: 2px solid rgba(0,0,255,0.25);
        }




Friday, 8 March 13
Gives you




Friday, 8 March 13
Controlling column
                          breaks
        article h2 {
          break-before: column;
          break-after: avoid-column;
        }




Friday, 8 March 13
Gives you




Friday, 8 March 13
Column-spanning
                         headings
        article h2 {
          break-after: avoid-column;
          column-span: all;
        }




Friday, 8 March 13
Gives you




Friday, 8 March 13
Can also specify
                      column width
        article {
          column-width: 20rem;
          column-gap: 2rem;
        }




Friday, 8 March 13
Gives you
Friday, 8 March 13
More on Multi-col
        http://dev.opera.com/articles/view/
        css3-multi-column-layout/




Friday, 8 March 13
Regions


Friday, 8 March 13
CSS regions
         ✴ Turn containers into vessels to
           flow content into
         ✴ Flexible complex layouts
         ✴ IE10 and Chrome Canary only at the
           moment




Friday, 8 March 13
Put your content in a
                 separate block
        <article class="content">
          <h2>Introduction</h2>
          <p>Hello, dear readers...
        </article>




Friday, 8 March 13
Then create your layout
            blocks
        <div class="layout">
          <div class="text-container"></div>
          <div class="text-container"></div>
          <div class="image-container">
            ...
          </div>
          <div class="text-container"></div>
        </div>
        <div class="text-overflow"></div>



Friday, 8 March 13
Specify where to
                        flow it into
        .content {
          -webkit-flow-into: article;
        }

        .text-container, .text-overflow {
          -webkit-flow-from: article;
        }




Friday, 8 March 13
A little something I
                          cooked up




Friday, 8 March 13
Exclusions and
                shapes


Friday, 8 March 13
CSS exclusions
         ✴ Create really complex floats
         ✴ Flow content around (and inside)
           complex shapes
         ✴ Chrome Canary/IE only at the
           moment




Friday, 8 March 13
Friday, 8 March 13
Position your exclusion
        <article class="content">
          <header>
            ...
          </header>
          ...
        </article>

        header {
          position: absolute;
          etc.
        }
Friday, 8 March 13
Then exclude it!
        header {
          position: absolute;
          etc.
          wrap-flow: both;
          /* Can also take values of start, end,
        minimum, maximum, clear */
        }




Friday, 8 March 13
Different effects
                      both      start    end




                                Text
                     minimum   maximum   clear




Friday, 8 March 13
Shape your exclusion
        shape-inside: rectangle(0, 0, 100%, 100%,
        25%, 25%);

        shape-inside: polygon( ... )

        shape-outside: polygon( ... )




Friday, 8 March 13
shape inside/outside




Friday, 8 March 13
A note on
                      CSS units


Friday, 8 March 13
rems
         ✴ rem units used throughout my
           examples
         ✴ size relative to the root (html) font-
           size, not the parent font size.
         ✴ Much easier maths




Friday, 8 March 13
vh, vw, and vmin
         ✴ Percentage of viewport size
         ✴ 1vw = 1% of viewport width
         ✴ 1vh = 1% of viewport height
         ✴ 1vmin = 1vw or 1vh, whatever is
           smallest




Friday, 8 March 13
vh, vw, and vmin
         ✴ Supported in IE10, FF Chrome, iOS,
                                ,
           Blackberry?
         ✴ text-size relative to viewport =
           accessibility problem?




Friday, 8 March 13
New responsive
                       capabilities




Friday, 8 March 13
Fallbacks and
              alternatives


Friday, 8 March 13
So do we just wait until support is
           everywhere and IE6-9 is destroyed?




Friday, 8 March 13
Hell no!
         ✴ Intelligent alternatives via feature
           detection
         ✴ @supports: native feature
           detection
         ✴ Modernizr is still an excellent
           solution



Friday, 8 March 13
Modernizr

        <html lang="en-US" class="no-js">
        <head>
          <script src="modernizr.js"></script>
        </head>




Friday, 8 March 13
Modernizr
        <html class=" js flexbox canvas canvastext
        webgl no-touch geolocation postmessage no-
        websqldatabase indexeddb hashchange history
        draganddrop websockets rgba hsla multiplebgs
        backgroundsize borderimage borderradius
        boxshadow textshadow opacity cssanimations
        csscolumns cssgradients no-cssreflections
        csstransforms no-csstransforms3d
        csstransitions fontface generatedcontent
        video audio ... ">




Friday, 8 March 13
Modernizr CSS
        .feature-no-regions .layout, .feature-no-
        regions .text-overflow {
          display: none;
        }

        .feature-no-regions .content {
          float: left;
          width: 48%;
          padding: 1%;
        }


Friday, 8 March 13
Fallback basic layout




Friday, 8 March 13
Modernizr JS
        function rotateForm() {
          if(Modernizr.cssanimations &&
             Modernizr.csstransforms3d) {
            form.setAttribute("class","form-rotate");
            form.style.left = "0rem";
          } else {
            back.style.zIndex = "5";
          }
        }



Friday, 8 March 13
“Subtle” advertisement
            Buy my book
Friday, 8 March 13
Thanks!


Friday, 8 March 13
Photo credits
         ✴ Star wars adidas posters by
           Dorothy Tang: http://
           www.flickr
                    .com/photos/adifans/
           4265441265/




Friday, 8 March 13

Mais conteúdo relacionado

Semelhante a Laying out the future

Responsive Web Design - An Accessibility Tool
Responsive Web Design - An Accessibility ToolResponsive Web Design - An Accessibility Tool
Responsive Web Design - An Accessibility ToolGeorge Zamfir
 
Create Accessible Infographics
Create Accessible Infographics Create Accessible Infographics
Create Accessible Infographics Ted Drake
 
Making the Switch, Part 1: Top 5 Things to Consider When Evaluating Drupal
Making the Switch, Part 1: Top 5 Things to Consider When Evaluating DrupalMaking the Switch, Part 1: Top 5 Things to Consider When Evaluating Drupal
Making the Switch, Part 1: Top 5 Things to Consider When Evaluating DrupalAcquia
 
Lone StarPHP 2013 - Building Web Apps from a New Angle
Lone StarPHP 2013 - Building Web Apps from a New AngleLone StarPHP 2013 - Building Web Apps from a New Angle
Lone StarPHP 2013 - Building Web Apps from a New AnglePablo Godel
 
Frozen Rails Slides
Frozen Rails SlidesFrozen Rails Slides
Frozen Rails Slidescarllerche
 
Passing a Front end Developer interview
Passing a Front end Developer interview Passing a Front end Developer interview
Passing a Front end Developer interview tonyfarnsworth
 
Butter Web Browsing with Margarine
Butter Web Browsing with MargarineButter Web Browsing with Margarine
Butter Web Browsing with MargarineWayne Walls
 
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJSTek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJSPablo Godel
 
Symfony2 and MongoDB - MidwestPHP 2013
Symfony2 and MongoDB - MidwestPHP 2013   Symfony2 and MongoDB - MidwestPHP 2013
Symfony2 and MongoDB - MidwestPHP 2013 Pablo Godel
 
The WordPress Hacker's Guide to the \Galaxy() [@MidwestPHP]
The WordPress Hacker's Guide to the \Galaxy() [@MidwestPHP]The WordPress Hacker's Guide to the \Galaxy() [@MidwestPHP]
The WordPress Hacker's Guide to the \Galaxy() [@MidwestPHP]Jason Rhodes
 
Unleashing the Rails Asset Pipeline
Unleashing the Rails Asset PipelineUnleashing the Rails Asset Pipeline
Unleashing the Rails Asset PipelineKenneth Kalmer
 
Lessons learned from Node.js - Callbacks / Promises
Lessons learned from Node.js - Callbacks / PromisesLessons learned from Node.js - Callbacks / Promises
Lessons learned from Node.js - Callbacks / PromisesJason K Yau
 
The WordPress Hacker's Guide to the \Galaxy() [@Baltimore PHP]
The WordPress Hacker's Guide to the \Galaxy() [@Baltimore PHP]The WordPress Hacker's Guide to the \Galaxy() [@Baltimore PHP]
The WordPress Hacker's Guide to the \Galaxy() [@Baltimore PHP]Jason Rhodes
 
Drupal 8 configuration system for coders and site builders - Drupalaton 2013
Drupal 8 configuration system for coders and site builders - Drupalaton 2013Drupal 8 configuration system for coders and site builders - Drupalaton 2013
Drupal 8 configuration system for coders and site builders - Drupalaton 2013swentel
 
Patterns in Rails
Patterns in RailsPatterns in Rails
Patterns in RailsCory Foy
 

Semelhante a Laying out the future (20)

ElasticSearch
ElasticSearchElasticSearch
ElasticSearch
 
Responsive Web Design - An Accessibility Tool
Responsive Web Design - An Accessibility ToolResponsive Web Design - An Accessibility Tool
Responsive Web Design - An Accessibility Tool
 
Create Accessible Infographics
Create Accessible Infographics Create Accessible Infographics
Create Accessible Infographics
 
Making the Switch, Part 1: Top 5 Things to Consider When Evaluating Drupal
Making the Switch, Part 1: Top 5 Things to Consider When Evaluating DrupalMaking the Switch, Part 1: Top 5 Things to Consider When Evaluating Drupal
Making the Switch, Part 1: Top 5 Things to Consider When Evaluating Drupal
 
Caching tips
Caching tipsCaching tips
Caching tips
 
Lone StarPHP 2013 - Building Web Apps from a New Angle
Lone StarPHP 2013 - Building Web Apps from a New AngleLone StarPHP 2013 - Building Web Apps from a New Angle
Lone StarPHP 2013 - Building Web Apps from a New Angle
 
Storyplayer
StoryplayerStoryplayer
Storyplayer
 
Frozen Rails Slides
Frozen Rails SlidesFrozen Rails Slides
Frozen Rails Slides
 
Passing a Front end Developer interview
Passing a Front end Developer interview Passing a Front end Developer interview
Passing a Front end Developer interview
 
Butter Web Browsing with Margarine
Butter Web Browsing with MargarineButter Web Browsing with Margarine
Butter Web Browsing with Margarine
 
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJSTek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJS
 
Enecomp 2009
Enecomp 2009Enecomp 2009
Enecomp 2009
 
Symfony2 and MongoDB - MidwestPHP 2013
Symfony2 and MongoDB - MidwestPHP 2013   Symfony2 and MongoDB - MidwestPHP 2013
Symfony2 and MongoDB - MidwestPHP 2013
 
The WordPress Hacker's Guide to the \Galaxy() [@MidwestPHP]
The WordPress Hacker's Guide to the \Galaxy() [@MidwestPHP]The WordPress Hacker's Guide to the \Galaxy() [@MidwestPHP]
The WordPress Hacker's Guide to the \Galaxy() [@MidwestPHP]
 
Unleashing the Rails Asset Pipeline
Unleashing the Rails Asset PipelineUnleashing the Rails Asset Pipeline
Unleashing the Rails Asset Pipeline
 
Lessons learned from Node.js - Callbacks / Promises
Lessons learned from Node.js - Callbacks / PromisesLessons learned from Node.js - Callbacks / Promises
Lessons learned from Node.js - Callbacks / Promises
 
The WordPress Hacker's Guide to the \Galaxy() [@Baltimore PHP]
The WordPress Hacker's Guide to the \Galaxy() [@Baltimore PHP]The WordPress Hacker's Guide to the \Galaxy() [@Baltimore PHP]
The WordPress Hacker's Guide to the \Galaxy() [@Baltimore PHP]
 
Wphackergalaxy
WphackergalaxyWphackergalaxy
Wphackergalaxy
 
Drupal 8 configuration system for coders and site builders - Drupalaton 2013
Drupal 8 configuration system for coders and site builders - Drupalaton 2013Drupal 8 configuration system for coders and site builders - Drupalaton 2013
Drupal 8 configuration system for coders and site builders - Drupalaton 2013
 
Patterns in Rails
Patterns in RailsPatterns in Rails
Patterns in Rails
 

Mais de Chris Mills

More efficient, usable web
More efficient, usable webMore efficient, usable web
More efficient, usable webChris Mills
 
Feedback handling, community wrangling, panhandlin’
Feedback handling, community wrangling, panhandlin’Feedback handling, community wrangling, panhandlin’
Feedback handling, community wrangling, panhandlin’Chris Mills
 
APIs for modern web apps
APIs for modern web appsAPIs for modern web apps
APIs for modern web appsChris Mills
 
APIs, now and in the future
APIs, now and in the futureAPIs, now and in the future
APIs, now and in the futureChris Mills
 
Guerrilla education
Guerrilla educationGuerrilla education
Guerrilla educationChris Mills
 
Web versus Native: round 1!
Web versus Native: round 1!Web versus Native: round 1!
Web versus Native: round 1!Chris Mills
 
Empowering the "mobile web"
Empowering the "mobile web"Empowering the "mobile web"
Empowering the "mobile web"Chris Mills
 
Documentation and publishing
Documentation and publishingDocumentation and publishing
Documentation and publishingChris Mills
 
Getting rid of images with CSS
Getting rid of images with CSSGetting rid of images with CSS
Getting rid of images with CSSChris Mills
 
Accessibility doesn't exist
Accessibility doesn't existAccessibility doesn't exist
Accessibility doesn't existChris Mills
 
Responsive web design standards?
Responsive web design standards?Responsive web design standards?
Responsive web design standards?Chris Mills
 
Adapt! Media queries and viewport
Adapt! Media queries and viewportAdapt! Media queries and viewport
Adapt! Media queries and viewportChris Mills
 
Adapt and respond: keeping responsive into the future
Adapt and respond: keeping responsive into the futureAdapt and respond: keeping responsive into the future
Adapt and respond: keeping responsive into the futureChris Mills
 
Angels versus demons: balancing shiny and inclusive
Angels versus demons: balancing shiny and inclusiveAngels versus demons: balancing shiny and inclusive
Angels versus demons: balancing shiny and inclusiveChris Mills
 
HTML5 and CSS3: does now really mean now?
HTML5 and CSS3: does now really mean now?HTML5 and CSS3: does now really mean now?
HTML5 and CSS3: does now really mean now?Chris Mills
 
The W3C and the web design ecosystem
The W3C and the web design ecosystemThe W3C and the web design ecosystem
The W3C and the web design ecosystemChris Mills
 
HTML5 Pearson preso
HTML5 Pearson presoHTML5 Pearson preso
HTML5 Pearson presoChris Mills
 
Brave new world of HTML5
Brave new world of HTML5Brave new world of HTML5
Brave new world of HTML5Chris Mills
 

Mais de Chris Mills (20)

More efficient, usable web
More efficient, usable webMore efficient, usable web
More efficient, usable web
 
Feedback handling, community wrangling, panhandlin’
Feedback handling, community wrangling, panhandlin’Feedback handling, community wrangling, panhandlin’
Feedback handling, community wrangling, panhandlin’
 
APIs for modern web apps
APIs for modern web appsAPIs for modern web apps
APIs for modern web apps
 
APIs, now and in the future
APIs, now and in the futureAPIs, now and in the future
APIs, now and in the future
 
Guerrilla education
Guerrilla educationGuerrilla education
Guerrilla education
 
Web versus Native: round 1!
Web versus Native: round 1!Web versus Native: round 1!
Web versus Native: round 1!
 
BrazilJS MDN
BrazilJS MDNBrazilJS MDN
BrazilJS MDN
 
Empowering the "mobile web"
Empowering the "mobile web"Empowering the "mobile web"
Empowering the "mobile web"
 
Documentation and publishing
Documentation and publishingDocumentation and publishing
Documentation and publishing
 
MDN is easy!
MDN is easy!MDN is easy!
MDN is easy!
 
Getting rid of images with CSS
Getting rid of images with CSSGetting rid of images with CSS
Getting rid of images with CSS
 
Accessibility doesn't exist
Accessibility doesn't existAccessibility doesn't exist
Accessibility doesn't exist
 
Responsive web design standards?
Responsive web design standards?Responsive web design standards?
Responsive web design standards?
 
Adapt! Media queries and viewport
Adapt! Media queries and viewportAdapt! Media queries and viewport
Adapt! Media queries and viewport
 
Adapt and respond: keeping responsive into the future
Adapt and respond: keeping responsive into the futureAdapt and respond: keeping responsive into the future
Adapt and respond: keeping responsive into the future
 
Angels versus demons: balancing shiny and inclusive
Angels versus demons: balancing shiny and inclusiveAngels versus demons: balancing shiny and inclusive
Angels versus demons: balancing shiny and inclusive
 
HTML5 and CSS3: does now really mean now?
HTML5 and CSS3: does now really mean now?HTML5 and CSS3: does now really mean now?
HTML5 and CSS3: does now really mean now?
 
The W3C and the web design ecosystem
The W3C and the web design ecosystemThe W3C and the web design ecosystem
The W3C and the web design ecosystem
 
HTML5 Pearson preso
HTML5 Pearson presoHTML5 Pearson preso
HTML5 Pearson preso
 
Brave new world of HTML5
Brave new world of HTML5Brave new world of HTML5
Brave new world of HTML5
 

Ú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 SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
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 RobisonAnna Loughnan Colquhoun
 
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 AutomationSafe Software
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
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 2024The Digital Insurer
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
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?Antenna Manufacturer Coco
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 

Último (20)

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
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
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
 
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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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?
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 

Laying out the future

  • 1. Laying out The future Friday, 8 March 13
  • 2. Find me... ✴ cmills@opera.com/cmills@w3.org ✴ @chrisdavidmills ✴ slideshare.net/chrisdavidmills Friday, 8 March 13
  • 3. In the early days ✴ We thought the Web was print ✴ Limited device landscape meant limited outlook ✴ Limited toolset Friday, 8 March 13
  • 4. Consistent CSS support ✴ Was very welcome... ✴ Still didn’t give us much in the way of layout Friday, 8 March 13
  • 5. CSS2 gave us ✴ floats: limiting, and kind of abused. ✴ positioning: feh. ✴ margins, padding: pfffff. ✴ borders. ✴ meh. Friday, 8 March 13
  • 6. We still have problems At this point, there was still a raft of design problems that were absurdly difficult to solve on the web. Friday, 8 March 13
  • 7. What about ✴ Centering stuff? ✴ Same height columns? ✴ Flexible multiple columns? ✴ Complex floats? ✴ Shrinkwrapping contents? ✴ etc. Friday, 8 March 13
  • 9. Same height columns ✴ We can fix this with faux columns ✴ Or JavaScript ✴ But really? Should we need to? Friday, 8 March 13
  • 10. Fortunately we have A New Hope Friday, 8 March 13
  • 11. New tools on the horizon ✴ CSS WG + browser vendors ✴ Hard at work Friday, 8 March 13
  • 13. Media queries ✴ Same content, different layouts ✴ Optimized UIs! ✴ Polyfills/fixed layouts for old IE Friday, 8 March 13
  • 14. Media queries /* Mobile first - make your mobile layout the default... */ @media screen and (min-width: 481px) { /* ...then do amazing stuff for wider screens */ } Friday, 8 March 13
  • 16. matchMedia ✴ matchMedia = media queries inside script ✴ For IE<10 and Opera Presto, polyfill github.com/paulirish/matchMedia.js/ Friday, 8 March 13
  • 17. matchMedia example if (window.matchMedia("(min-width: 480px)").matches) { /* Do stuff for wider screens */ } else { /* Do stuff for narrow screens */ } Friday, 8 March 13
  • 18. More on Media queries http://dev.opera.com/articles/view/ love-your -devices-adaptive-web- design-with-media-queries-viewport- and-more/ Friday, 8 March 13
  • 19. viewport/CSS device adaptation Friday, 8 March 13
  • 20. Mobile browsers lie ✴ About viewport width ✴ Some also lie about the resolution ✴ So media queries alone don’t cut it Friday, 8 March 13
  • 22. Viewport <meta name="viewport" content="width=device-width"> Friday, 8 March 13
  • 24. @viewport ✴ Because viewport is more of a style thing ✴ Specify viewport inside the @viewport rule ✴ Opera Presto, IE10, WebKit Friday, 8 March 13
  • 25. Viewport @viewport { width: device-width; } Friday, 8 March 13
  • 26. More on viewport and @ viewport http://dev.opera.com/articles/view/an- introduction-to-meta-viewport-and- viewport/ Friday, 8 March 13
  • 28. Flexbox rocks ✴ Allows easy flexible layouts ✴ Content reordering ✴ Same height columns ✴ Cure for cancer? ✴ Chrome, Opera Presto, FF IE (old , syntax) Friday, 8 March 13
  • 29. An example <section> <nav> ... </nav> <article> ... </article> <article> ... </article> </section> Friday, 8 March 13
  • 30. An example section { display: flex; } Friday, 8 March 13
  • 32. Rows and columns section { display: flex; flex-direction: row; flex-wrap: nowrap; } /* flex-flow is shorthand for flex-direction/ wrap */ Friday, 8 March 13
  • 33. Main and cross axis Friday, 8 March 13
  • 34. align items on main axis section { justify-content: center; } /* can take other values such as flex-start, flex-end, space-between and space-around */ Friday, 8 March 13
  • 36. align items on cross axis section { align-items: stretch; } /* can take other values such as flex-start, flex-end, and center; */ Friday, 8 March 13
  • 38. Ordering elements ✴ Reorder child elements easily and quickly ✴ Without screwing with the DOM Friday, 8 March 13
  • 39. Ordinal groups nav { order: 1; } Friday, 8 March 13
  • 41. Flexing our muscle ✴ The flex property ✴ Set what proportion of available space child elements occupy ✴ Unit-less proportion values Friday, 8 March 13
  • 42. Flex property nav { flex: 1; } article { flex: 3; } Friday, 8 March 13
  • 44. But there’s more article { flex: 3 2 400px; } /* flex-grow shares out positive space flex-shrink shares out overflow reduction flex-basis initially applied = CAN GET BLOODY COMPLICATED */ Friday, 8 March 13
  • 45. A case study Friday, 8 March 13
  • 46. Placing the nav section { display: flex; flex-flow: row wrap; } nav { flex: 1 100%; } Friday, 8 March 13
  • 48. Making awesome nav { display: flex; justify-content: center; } nav ul { display: flex; flex-flow: row wrap; justify-content: center; width: 80%; } Friday, 8 March 13
  • 49. Making awesome nav ul li { flex: auto; min-width: 5rem; } Friday, 8 March 13
  • 50. More on Flexbox http://dev.opera.com/articles/view/ flexbox-basics/ Friday, 8 March 13
  • 52. Multi-col layouts ✴ Break content into multi-col ✴ Cut down on markup cruft ✴ Specify column breaks, column rules and heading span ✴ Most modern browsers have this Friday, 8 March 13
  • 53. Great at some things <article>...</article> article { column-count: 2; column-gap: 1rem; column-rule: 2px solid rgba(0,0,255,0.25); } Friday, 8 March 13
  • 55. Controlling column breaks article h2 { break-before: column; break-after: avoid-column; } Friday, 8 March 13
  • 57. Column-spanning headings article h2 { break-after: avoid-column; column-span: all; } Friday, 8 March 13
  • 59. Can also specify column width article { column-width: 20rem; column-gap: 2rem; } Friday, 8 March 13
  • 61. More on Multi-col http://dev.opera.com/articles/view/ css3-multi-column-layout/ Friday, 8 March 13
  • 63. CSS regions ✴ Turn containers into vessels to flow content into ✴ Flexible complex layouts ✴ IE10 and Chrome Canary only at the moment Friday, 8 March 13
  • 64. Put your content in a separate block <article class="content"> <h2>Introduction</h2> <p>Hello, dear readers... </article> Friday, 8 March 13
  • 65. Then create your layout blocks <div class="layout"> <div class="text-container"></div> <div class="text-container"></div> <div class="image-container"> ... </div> <div class="text-container"></div> </div> <div class="text-overflow"></div> Friday, 8 March 13
  • 66. Specify where to flow it into .content { -webkit-flow-into: article; } .text-container, .text-overflow { -webkit-flow-from: article; } Friday, 8 March 13
  • 67. A little something I cooked up Friday, 8 March 13
  • 68. Exclusions and shapes Friday, 8 March 13
  • 69. CSS exclusions ✴ Create really complex floats ✴ Flow content around (and inside) complex shapes ✴ Chrome Canary/IE only at the moment Friday, 8 March 13
  • 71. Position your exclusion <article class="content"> <header> ... </header> ... </article> header { position: absolute; etc. } Friday, 8 March 13
  • 72. Then exclude it! header { position: absolute; etc. wrap-flow: both; /* Can also take values of start, end, minimum, maximum, clear */ } Friday, 8 March 13
  • 73. Different effects both start end Text minimum maximum clear Friday, 8 March 13
  • 74. Shape your exclusion shape-inside: rectangle(0, 0, 100%, 100%, 25%, 25%); shape-inside: polygon( ... ) shape-outside: polygon( ... ) Friday, 8 March 13
  • 76. A note on CSS units Friday, 8 March 13
  • 77. rems ✴ rem units used throughout my examples ✴ size relative to the root (html) font- size, not the parent font size. ✴ Much easier maths Friday, 8 March 13
  • 78. vh, vw, and vmin ✴ Percentage of viewport size ✴ 1vw = 1% of viewport width ✴ 1vh = 1% of viewport height ✴ 1vmin = 1vw or 1vh, whatever is smallest Friday, 8 March 13
  • 79. vh, vw, and vmin ✴ Supported in IE10, FF Chrome, iOS, , Blackberry? ✴ text-size relative to viewport = accessibility problem? Friday, 8 March 13
  • 80. New responsive capabilities Friday, 8 March 13
  • 81. Fallbacks and alternatives Friday, 8 March 13
  • 82. So do we just wait until support is everywhere and IE6-9 is destroyed? Friday, 8 March 13
  • 83. Hell no! ✴ Intelligent alternatives via feature detection ✴ @supports: native feature detection ✴ Modernizr is still an excellent solution Friday, 8 March 13
  • 84. Modernizr <html lang="en-US" class="no-js"> <head> <script src="modernizr.js"></script> </head> Friday, 8 March 13
  • 85. Modernizr <html class=" js flexbox canvas canvastext webgl no-touch geolocation postmessage no- websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients no-cssreflections csstransforms no-csstransforms3d csstransitions fontface generatedcontent video audio ... "> Friday, 8 March 13
  • 86. Modernizr CSS .feature-no-regions .layout, .feature-no- regions .text-overflow { display: none; } .feature-no-regions .content { float: left; width: 48%; padding: 1%; } Friday, 8 March 13
  • 88. Modernizr JS function rotateForm() { if(Modernizr.cssanimations && Modernizr.csstransforms3d) { form.setAttribute("class","form-rotate"); form.style.left = "0rem"; } else { back.style.zIndex = "5"; } } Friday, 8 March 13
  • 89. “Subtle” advertisement Buy my book Friday, 8 March 13
  • 91. Photo credits ✴ Star wars adidas posters by Dorothy Tang: http:// www.flickr .com/photos/adifans/ 4265441265/ Friday, 8 March 13