SlideShare a Scribd company logo
USING         MEDIA QUERIES
to build Mobile Web Applications
@kevinderudder working for
eGuidelines and a lecturer at the
Technical University of West Flanders.

Contact me on kevin@e-guidelines.be
Media queries
Website on a desktop   Website on a mobile phone
Media queries
Media queries
Agenda



•   Why this topic
•   Native vs Web apps
•   Responsive Design
•   HTML5 and CSS3 to the rescue
•   Usefull HTML5 Tags
•   Media Queries
WHY THIS TOPIC
Photo by http://neuroticworkaholic.blogspot.com
Media queries
Media queries
As a web developer you should target
        multiple (all) devices
HOW??
Native vs WEB
Native Development

• Windows Metro Applications
  • XAML with C#, VB.NET or C++
  • HTML with JavaScript


• iOS apps
  • Objective C


• Android
  • Java
HTML5 and CSS3
to the rescue
=   CONTENT




=   UI
Media queries
HTML5

   Structure    Indexed DB     File APIs     Forms




   Audio and                   History
                Web Workers                   XHR2
     Video                    Navigation

                                                         ...

                              Drag and
    Canvas      WebSockets                 Messaging
                                Drop



                Server-Sent
  Web Storage                  Offline     Geolocation
                  Events
HTML5

   Structure    Indexed DB     File APIs     Forms




   Audio and                   History
                Web Workers                   XHR2
     Video                    Navigation

                                                         ...

                              Drag and
    Canvas      WebSockets                 Messaging
                                Drop



                Server-Sent
  Web Storage                  Offline     Geolocation
                  Events
CSS3


       Rounded                    Colors
                   Box Shadow                  Text Effects
       Corners                   HSL, HSLA




                                Multi-column
       Box Model   Web Fonts                    Borders
                                  layout




        Media                                   Attribute
                   Background    Selectors
        Queries                                 matching
CSS3


       Rounded                    Colors
                   Box Shadow                  Text Effects
       Corners                   HSL, HSLA




                                Multi-column
       Box Model   Web Fonts                    Borders
                                  layout




        Media                                   Attribute
                   Background    Selectors
        Queries                                 matching
Media queries
Media queries
Media queries
Media queries
Let’s get started and change that MVC site
into a cross platform/device web application
Before you even think about designing

CONTENT IS KING
Media queries
Media queries
How do you point to the specific content??
<div id=“header”> <div id=“top” />...
          <div id=“navigation”> <div id=“menu”>...

                                 <div id=“main”>



                               <div class=“content”>
<div id=“left”>



                               <div class=“content”>



                     <div id=“footer”>
<header>
           <nav>

                     <section>



                     <article>
<aside>



                     <article>



          <footer>
Media queries
<header />         <nav />


                  <article />             <section />


 <aside />




<footer />
<header />


               <nav />


<section />




              <aside />




              <article />
DEMO
<header />         <nav />


                  <article />             <section />


 <aside />




<footer />
Make it MOBILE
How are you gonna serve the page to the device
     1. Redirect
     2. Responsive design via Media Queries
How are you gonna serve the page to the device
     1. Redirect
     2. Responsive design via Media Queries
<script type="text/javascript">

   if (screen.width <= 320) {
       document.location = "m.microsoft.com";
   }

</script>
Media queries
Media queries
Media queries
This is good, if you want to deliver different
                   content
Media queries
Media queries
But, do you create a custom experience for
       each (new) browser or device
How are you gonna serve the page to the device
     1. Redirect
     2. Responsive design via Media Queries
What does it mean: RESPONSIVE
Pictures of M. vatia
Pictures of M. vatia
Media queries
Media queries
Media queries
Media queries
If you want to make your web app responsive, you
should implement 3 ingredients
     • A flexible, grid-based layout
     • Flexible images and media
     • Media Queries
Media queries
We will only focus on Media Queries
Media queries
Media queries
Media queries
Media Queries allow you write design code
 based on the characteristics of a device
Media Queries exists out of 2 parts

                     MEDIA QUERY

          Type               Query or Expression

  @media all and (max-width: 640px) {

  }
Media Queries exists out of 2 parts
 1. Media Type
 2. Expression
Media Types
Media queries
Global.css
The media types

                                                             Taken from the W3C site
All          Suitable for all devices
Braille      Intended for braille tactile feedback devices
Embossed     Intended for paged braille printers
Handheld     Intended for handheld devices
Print        Intended for paged material
Projection   Intended for projected presentations
Screen       Intended primarily for color computer screens
Speech       Inteded for speech synthesizers
Tty          Media using a fixed character grid
Tv           Intended for television-type devices
AHA, there is something like handheld
@media screen
{
    body
    {
         background-color: Red;
    }
}

@media handheld
{
    body
    {
         background-color: Yellow;
    }
}

                                     This is not yellow
Old devices didn’t have capable browsers
Modern mobile devices use screen as media type
Media Queries exists out of 2 parts
 1. Media Type
 2. Expression
MEDIA QUERY

     Type            Query or Expression

@media all and (max-width: 640px) {
                   Feature           Value


}
The Features

Features with min- and max- prefixes

•   Width                     •   Aspect-ratio
•   Height                    •   Device-aspect-ratio
•   Device-width              •   Color
•   Device-height             •   Color-index
•   Resolution                •   Monochrome
The Features

Features without min- and max- prefixes
• Orientation
• Scan
• Grid
3 Ways to implement Media Queries


1.




2.



3.
A Media Query
Combine multiple queries
Combine multiple queries
NOT
DEMO
RESOURCES
Media queries
Media queries
Media queries
Thank you
kevin@e-guidelines.be

More Related Content

PPTX
The value of structured data
PDF
The Modern Web, Part 2: HTML5
PDF
CSS Training Online-Online CSS Course css course online learning html and css...
PDF
Rubedo 2.2 : features list
PPT
CSS Media Queries (WordCamp 2010)
PDF
Responsive Design Workflow: Webshaped 2012
PDF
Web guidelines in practice
PDF
HTML5 & Webrichtlijnen 2
The value of structured data
The Modern Web, Part 2: HTML5
CSS Training Online-Online CSS Course css course online learning html and css...
Rubedo 2.2 : features list
CSS Media Queries (WordCamp 2010)
Responsive Design Workflow: Webshaped 2012
Web guidelines in practice
HTML5 & Webrichtlijnen 2

Viewers also liked (20)

PDF
CSS3: Using media queries to improve the web site experience
PDF
Flexbox: One Giant Leap for Web Layout (CSS Day 2013)
PDF
Adapt! Media queries and viewport
PDF
The Backside of the Class (CSS Day 2015)
PDF
CSS Font & Text style
PDF
Real-world Responsive Design @ Breaking Development 2011
PDF
CSS3 Media Queries: Mobile Elixir or CSS Snake Oil
PDF
Meta layout: a closer look at media queries
PDF
From Deception to Clarity
PPTX
Dynamic vs static
PDF
Beyond Media Queries: Anatomy of an Adaptive Web Design
PDF
CSS3, Media Queries, and Responsive Design
PDF
More than Media Queries: Reframing Responsive UX - SXSW 2016
PPTX
HTML Block and Inline Elements
PDF
The future of media queries?
PDF
The Future State of Layout
PDF
Maintainable CSS
PDF
CSS3 Media Queries
PDF
Go With The Flow
PPT
Social media and your website
CSS3: Using media queries to improve the web site experience
Flexbox: One Giant Leap for Web Layout (CSS Day 2013)
Adapt! Media queries and viewport
The Backside of the Class (CSS Day 2015)
CSS Font & Text style
Real-world Responsive Design @ Breaking Development 2011
CSS3 Media Queries: Mobile Elixir or CSS Snake Oil
Meta layout: a closer look at media queries
From Deception to Clarity
Dynamic vs static
Beyond Media Queries: Anatomy of an Adaptive Web Design
CSS3, Media Queries, and Responsive Design
More than Media Queries: Reframing Responsive UX - SXSW 2016
HTML Block and Inline Elements
The future of media queries?
The Future State of Layout
Maintainable CSS
CSS3 Media Queries
Go With The Flow
Social media and your website
Ad

Similar to Media queries (20)

PDF
Introduction to CSS3
PDF
Devon 2011-f-1 반응형 웹 디자인
PDF
HTML5 and the dawn of rich mobile web applications pt 1
KEY
Responsive Web Design
PPTX
Html5 more than just html5 v final
PDF
Web Development for UX Designers
PPTX
Developing for Responsive Design - Frederic Welterlin
PPTX
TERMINALFOUR t44u 2009 - University of St Andrews Case Study
PDF
Every Web Developer is a Win8 developer
PPTX
When worlds Collide: HTML5 Meets the Cloud
PDF
Cross platform mobile web apps
PPTX
HTML5 - A Whirlwind tour
PDF
Full download Responsive Web Design with HTML5 and CSS3 Second Edition Ben Fr...
PDF
Wordcamp Thessaloniki 2011 The Nextweb
PDF
HTML5 and CSS3 refresher
PDF
From Flash to Canvas - a penchant for black holes
PDF
Bd conf sencha touch workshop
PPTX
HTML5: An Overview
PPT
The Mobile Development Landscape
PPTX
The web as it should be
Introduction to CSS3
Devon 2011-f-1 반응형 웹 디자인
HTML5 and the dawn of rich mobile web applications pt 1
Responsive Web Design
Html5 more than just html5 v final
Web Development for UX Designers
Developing for Responsive Design - Frederic Welterlin
TERMINALFOUR t44u 2009 - University of St Andrews Case Study
Every Web Developer is a Win8 developer
When worlds Collide: HTML5 Meets the Cloud
Cross platform mobile web apps
HTML5 - A Whirlwind tour
Full download Responsive Web Design with HTML5 and CSS3 Second Edition Ben Fr...
Wordcamp Thessaloniki 2011 The Nextweb
HTML5 and CSS3 refresher
From Flash to Canvas - a penchant for black holes
Bd conf sencha touch workshop
HTML5: An Overview
The Mobile Development Landscape
The web as it should be
Ad

More from Kevin DeRudder (12)

PPTX
Build your own Cloud/Home security system for 60$
PDF
Comparing xaml and html
PDF
ECMASCRIPT.NEXT
PDF
VISUG: Visual studio for web developers
PDF
Testing apps with MTM and Tea Foundation Service
PDF
ECMAScript.Next ECMAScipt 6
PDF
Building cross platform applications using Windows Azure Mobile Services
PDF
Responsive SharePoint
PDF
Use html5 to build what you want, where you want it
PDF
Developers and Designers
PDF
What you need to know bout html5
PDF
Html5 intro
Build your own Cloud/Home security system for 60$
Comparing xaml and html
ECMASCRIPT.NEXT
VISUG: Visual studio for web developers
Testing apps with MTM and Tea Foundation Service
ECMAScript.Next ECMAScipt 6
Building cross platform applications using Windows Azure Mobile Services
Responsive SharePoint
Use html5 to build what you want, where you want it
Developers and Designers
What you need to know bout html5
Html5 intro

Recently uploaded (20)

PPTX
mahatma gandhi bus terminal in india Case Study.pptx
PPTX
building Planning Overview for step wise design.pptx
PPTX
6- Architecture design complete (1).pptx
DOCX
actividad 20% informatica microsoft project
PDF
UNIT 1 Introduction fnfbbfhfhfbdhdbdto Java.pptx.pdf
PDF
SEVA- Fashion designing-Presentation.pdf
PPT
pump pump is a mechanism that is used to transfer a liquid from one place to ...
PPTX
Special finishes, classification and types, explanation
PDF
Urban Design Final Project-Context
PPTX
Tenders & Contracts Works _ Services Afzal.pptx
PPTX
BSCS lesson 3.pptxnbbjbb mnbkjbkbbkbbkjb
PDF
Emailing DDDX-MBCaEiB.pdf DDD_Europe_2022_Intro_to_Context_Mapping_pdf-165590...
PPTX
An introduction to AI in research and reference management
PPTX
artificialintelligencedata driven analytics23.pptx
PPTX
AC-Unit1.pptx CRYPTOGRAPHIC NNNNFOR ALL
PDF
High-frequency high-voltage transformer outline drawing
PDF
Urban Design Final Project-Site Analysis
PDF
The Advantages of Working With a Design-Build Studio
PPTX
ANATOMY OF ANTERIOR CHAMBER ANGLE AND GONIOSCOPY.pptx
PDF
Africa 2025 - Prospects and Challenges first edition.pdf
mahatma gandhi bus terminal in india Case Study.pptx
building Planning Overview for step wise design.pptx
6- Architecture design complete (1).pptx
actividad 20% informatica microsoft project
UNIT 1 Introduction fnfbbfhfhfbdhdbdto Java.pptx.pdf
SEVA- Fashion designing-Presentation.pdf
pump pump is a mechanism that is used to transfer a liquid from one place to ...
Special finishes, classification and types, explanation
Urban Design Final Project-Context
Tenders & Contracts Works _ Services Afzal.pptx
BSCS lesson 3.pptxnbbjbb mnbkjbkbbkbbkjb
Emailing DDDX-MBCaEiB.pdf DDD_Europe_2022_Intro_to_Context_Mapping_pdf-165590...
An introduction to AI in research and reference management
artificialintelligencedata driven analytics23.pptx
AC-Unit1.pptx CRYPTOGRAPHIC NNNNFOR ALL
High-frequency high-voltage transformer outline drawing
Urban Design Final Project-Site Analysis
The Advantages of Working With a Design-Build Studio
ANATOMY OF ANTERIOR CHAMBER ANGLE AND GONIOSCOPY.pptx
Africa 2025 - Prospects and Challenges first edition.pdf

Media queries

  • 1. USING MEDIA QUERIES to build Mobile Web Applications
  • 2. @kevinderudder working for eGuidelines and a lecturer at the Technical University of West Flanders. Contact me on kevin@e-guidelines.be
  • 4. Website on a desktop Website on a mobile phone
  • 7. Agenda • Why this topic • Native vs Web apps • Responsive Design • HTML5 and CSS3 to the rescue • Usefull HTML5 Tags • Media Queries
  • 12. As a web developer you should target multiple (all) devices
  • 14. Native Development • Windows Metro Applications • XAML with C#, VB.NET or C++ • HTML with JavaScript • iOS apps • Objective C • Android • Java
  • 15. HTML5 and CSS3 to the rescue
  • 16. = CONTENT = UI
  • 18. HTML5 Structure Indexed DB File APIs Forms Audio and History Web Workers XHR2 Video Navigation ... Drag and Canvas WebSockets Messaging Drop Server-Sent Web Storage Offline Geolocation Events
  • 19. HTML5 Structure Indexed DB File APIs Forms Audio and History Web Workers XHR2 Video Navigation ... Drag and Canvas WebSockets Messaging Drop Server-Sent Web Storage Offline Geolocation Events
  • 20. CSS3 Rounded Colors Box Shadow Text Effects Corners HSL, HSLA Multi-column Box Model Web Fonts Borders layout Media Attribute Background Selectors Queries matching
  • 21. CSS3 Rounded Colors Box Shadow Text Effects Corners HSL, HSLA Multi-column Box Model Web Fonts Borders layout Media Attribute Background Selectors Queries matching
  • 26. Let’s get started and change that MVC site into a cross platform/device web application
  • 27. Before you even think about designing CONTENT IS KING
  • 30. How do you point to the specific content??
  • 31. <div id=“header”> <div id=“top” />... <div id=“navigation”> <div id=“menu”>... <div id=“main”> <div class=“content”> <div id=“left”> <div class=“content”> <div id=“footer”>
  • 32. <header> <nav> <section> <article> <aside> <article> <footer>
  • 34. <header /> <nav /> <article /> <section /> <aside /> <footer />
  • 35. <header /> <nav /> <section /> <aside /> <article />
  • 36. DEMO
  • 37. <header /> <nav /> <article /> <section /> <aside /> <footer />
  • 39. How are you gonna serve the page to the device 1. Redirect 2. Responsive design via Media Queries
  • 40. How are you gonna serve the page to the device 1. Redirect 2. Responsive design via Media Queries
  • 41. <script type="text/javascript"> if (screen.width <= 320) { document.location = "m.microsoft.com"; } </script>
  • 45. This is good, if you want to deliver different content
  • 48. But, do you create a custom experience for each (new) browser or device
  • 49. How are you gonna serve the page to the device 1. Redirect 2. Responsive design via Media Queries
  • 50. What does it mean: RESPONSIVE
  • 51. Pictures of M. vatia
  • 52. Pictures of M. vatia
  • 57. If you want to make your web app responsive, you should implement 3 ingredients • A flexible, grid-based layout • Flexible images and media • Media Queries
  • 59. We will only focus on Media Queries
  • 63. Media Queries allow you write design code based on the characteristics of a device
  • 64. Media Queries exists out of 2 parts MEDIA QUERY Type Query or Expression @media all and (max-width: 640px) { }
  • 65. Media Queries exists out of 2 parts 1. Media Type 2. Expression
  • 69. The media types Taken from the W3C site All Suitable for all devices Braille Intended for braille tactile feedback devices Embossed Intended for paged braille printers Handheld Intended for handheld devices Print Intended for paged material Projection Intended for projected presentations Screen Intended primarily for color computer screens Speech Inteded for speech synthesizers Tty Media using a fixed character grid Tv Intended for television-type devices
  • 70. AHA, there is something like handheld
  • 71. @media screen { body { background-color: Red; } } @media handheld { body { background-color: Yellow; } } This is not yellow
  • 72. Old devices didn’t have capable browsers
  • 73. Modern mobile devices use screen as media type
  • 74. Media Queries exists out of 2 parts 1. Media Type 2. Expression
  • 75. MEDIA QUERY Type Query or Expression @media all and (max-width: 640px) { Feature Value }
  • 76. The Features Features with min- and max- prefixes • Width • Aspect-ratio • Height • Device-aspect-ratio • Device-width • Color • Device-height • Color-index • Resolution • Monochrome
  • 77. The Features Features without min- and max- prefixes • Orientation • Scan • Grid
  • 78. 3 Ways to implement Media Queries 1. 2. 3.
  • 82. NOT
  • 83. DEMO