SlideShare une entreprise Scribd logo
1  sur  81
Télécharger pour lire hors ligne
Responsive Web Design
e a ubiquidade da web




Eduardo Shiota Yasuda
@shiota | www.eshiota.com
Uma (breve) História
do Design na Web
Tim Berners-Lee
Pai do HTTP, HTML, diretor da W3C, e cavaleiro.
Primeira página da Web
http://www.w3.org/History/19921103-hypertext/hypertext/WWW/TheProject.html
Primeira Página do UOL
23/12/1996 - archive.org
EVIL
HTML » Print » Table » Tableless » Standards » ?
http://1to1interactive.net/blog/?p=1718
http://babybilingual.blogspot.com.br/2012/05/who-knew-spelling-could-be-so-cute-and_19.html
http://www.theinternetisclosedforwinter.com/2012/06/yes-people-use-ipad-as-camera.html
Jeremy Keith's — @adactio — Instagram
HTML » Print » Table » Tableless » Standards »
     Responsive Web Design
Responsive Web Design
   Solução agnóstica à plataforma, browser e dispositivo
UOL
           Close, but no cigar.




Desktop   iPad Portrait    iPad Landscape   iPhone       iPhone
                                            Portrait   Landscape
UOL
          Close, but no cigar.




Desktop                          Desktop?
The Boston Globe
                Responsivelicious




Desktop       iPad Portrait   iPad Landscape   iPhone       iPhone
                                               Portrait   Landscape
1. Design flexível
         +
2. Media Queries
         +
3. Ajustes e plugins
Flexible Web Design
     Tipografia, grid & conteúdo
Golden rule
Target ÷ Contexto = Dimensão
Tipografia
   `em`
70px/80px




    24px/32px




14px/21px
body {
  font: normal normal 14px/21px "cabin", sans-serif;
}

.headline h1 {
  font: normal bold 70px/80px "enriqueta", serif;
}

.headline p {
  font-size: 24px;
  line-height: 32px;
}
body » font-size: 100%
  (16px na maioria dos browsers)
body {
  font: normal normal 100%/1.5 "cabin", sans-serif;
}
target (70px)




       target (24px)




                       CONTEXTO » body (16px)




target (14px)
Target ÷ Contexto = Dimensão

  70px ÷ 16px = 4.375em
 80px ÷ 70px = 1.142857143

    24px ÷ 16px = 1.5em
   32px ÷ 24px = 1.333333
body {
  font: normal normal 100%/1.5 "cabin", sans-serif;
}

.headline h1 {
  /* 70px ÷ 16px & 80px ÷ 70px */
  font: normal bold 4.375em/1.142857143 "enriqueta", serif;
}

.headline p {
  font-size: 1.5em; /* 24px ÷ 16px */
  line-height: 1.333333; /* 32px ÷ 24px */
}

.blog-post .post-content {
  font-size: .875em; /* 14px ÷ 16px */
}
Grids
 %
1000px


65px




       20px




660px         320px
#container {
  width: 1000px;
}

.main-content {
  float: left;
  width: 660px;
  margin-right: 20px;
}

.side-content {
  float: left;
  width: 320px;
}
Contexto (1000px)


Target (65px)


    Target (20px)




Target (660px)      Target (320px)
Target ÷ Contexto = Dimensão

       1000px = 100%

   660px ÷ 1000px = 66%
    20px ÷ 1000px = 2%
   320px ÷ 1000px = 32%
#container {
  width: 100%;
}

.main-content {
  float: left;
  width: 66%; /* 660px ÷ 1000px */
  margin-right: 2%; /* 20px ÷ 1000px */
}

.side-content {
  float: left;
  width: 32%; /* 32px ÷ 1000px */
}
Conteúdo
max-width: 100%
img, embed, object, video

     (IE6 => width: 100%)
525px


        210px
.blog-post .alignright {
  float: right;
  margin: 0 0 20px 16px;
}

.blog-post .alignright img {
  /* + 2px border + 2px padding = 210px */
  width: 206px;
}
Contexto (525px)


                   Target (210px)
Target ÷ Contexto = Dimensão

    210px ÷ 525px = 40%
.blog-post .alignright {
  float: right;
  margin: 0 0 20px 16px;
  width: 40%;
}

.blog-post .alignright img {
  max-width: 100%;
  -moz-box-sizing: border-box;
       box-sizing: border-box;
}
$(function () {
  $(“#site-content”).find(“.main-content”).fitVids();
});
$(function () {
  $(“#site-content”).find(“.main-content”).fitVids();

  // FitText's formula:
  //
  // fontSize = elementWidth / (compressor * 10)
  // fontSize = 70
  // elementWidth = 1000
  // compressor = 100/70 = 1.428571429
  $("#site-content")
     .find(".headline h1")
     .fitText(1.428571429, {
       minFontSize: "36px",
       maxFontSize: "96px"
     });
});
Media Queries
    Tipos e features
Tipos
all, braille, embossed, handheld, print, projection, screen, speech, tty, tv




Features
color                                    (min | max-)width
color-index                              grid
(min | max-)aspect-ratio                 monochrome
(min | max-)device-aspect-ratio          orientation
(min | max-)device-height                (min | max-)resolution
(min | max-)device-width                 scan
(min | max-)height                       -webkit-(min | max-)device-pixel-ratio
Sintaxe
[only | not]? {tipo} and ({feature}[:{valor}]?) [and ({feature}[:{valor}]?)]*
[, [only | not]? {tipo} and ({feature}: [:{valor}]?) [and ({feature}[:{valor}]?)]* ]




Uso
<link rel=”stylesheet” href=”wide.css” media=”screen and (min-width:1200px)” />



ou
@media screen and (max-width: 1200px) {
  /* insert styles here */
}
Exemplos
@media print and (max-width:21cm) {}

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

@media only screen and (orientation:landscape)
              and (min-device-width:768px)
              and (max-device-width:1024px),
       only screen and (-webkit-device-aspect-ratio:1.5) {}
Exemplos
@media only screen and (orientation:landscape)
              and (min-device-width:768px)
              and (max-device-width:1024px),
       only screen and (-webkit-device-aspect-ratio:1.5) {}

   device-width: 1024px                     -webkit-device-aspect-ratio: 1.5
                                            (novo iPad)




                                            device-height: 768px

                                           orientation: landscape
@media screen and (max-width: 1024px) {
  // Diminuir a fonte do menu
}

@media screen and (max-width: 960px) {
  // Diminuir Header, logo e H2
  // Galeria de fotos em 3 colunas
  // Nav fixo à esquerda
  // Search input maior
}

@media screen and (max-width: 840px) {
  // Diminuir H2, nav e campo de busca
  // Formatação de data simples
}

@media screen and (max-width: 767px) {
  // Uma coluna ao invés de duas
}
Retina Display
The New iPad™, iPhone 4(S), The Next Generation MacBook Pro with Retina Display™
16 x 1 physical pixels
16 x 1 virtual pixels
device-pixel-ratio: 1    Normal displays




32 x 2 physical pixels
16 x 1 virtual pixels
device-pixel-ratio: 2    “Retina” displays
Display: Mostra physical pixels

 CSS: Interpreta virtual pixels
Physical Pixels: Imagens 4x maiores (2x width / 2x height)

Virtual Pixels: Dimensões virtuais, imagens redimensionadas
57px


240px
Normal display

                 sprite.png


                                  130px




                          260px
Normal display
#site-header h1 a {
    display: block;
    width: 240px;
    height: 57px;
    background-image: url(../images/sprite.png);
    background-repeat: no-repeat;
    background-position: -10px -10px;
    overflow: hidden;
    text-indent: 100%;
    white-space: nowrap;
}
“Retina” display
          sprite@2x.png




                                  260px




                          520px
“Retina” display
@media screen and (-webkit-min-device-pixel-ratio: 2) {
    #site-header h1 a {
        width: 240px; /* Virtual pixels, continua igual */
        height: 57px; /* Virtual pixels, continua igual */
        background-image: url(../images/sprite@2x.png);
        background-position: -10px -10px; /* Virtual pixels, continua igual */
        -webkit-background-size: 50% 50%; /* Dimensionando os Physical */
           -moz-background-size: 50% 50%; /* Pixels da imagem para os   */
            -ms-background-size: 50% 50%; /* Virtual Pixels do browser */
             -o-background-size: 50% 50%;
                background-size: 50% 50%;
        overflow: hidden;
        text-indent: 100%;
        white-space: nowrap;
    }
}
“Retina” display
@media screen and (-webkit-min-device-pixel-ratio: 2) {
    #site-header h1 a {
        background-image: url(../images/sprite@2x.png);
        -webkit-background-size: 50% 50%;
           -moz-background-size: 50% 50%;
            -ms-background-size: 50% 50%;
             -o-background-size: 50% 50%;
                background-size: 50% 50%;
    }
}
Responsive Images
3008 x 2000
FAIL
<div data-picture data-alt="A beautiful kitty">
    <div data-src="jamie_small.jpg"></div>
    <div data-src="jamie_medium.jpg"     data-media="(min-width: 400px)"></div>
    <div data-src="jamie_large.jpg"      data-media="(min-width: 800px)"></div>
    <div data-src="jamie_extralarge.jpg" data-media="(min-width: 1000px)"></div>

    <!-- Fallback content for non-JS browsers. -->
    <noscript>
        <img src="external/imgs/jamie_small.jpg" alt="A beautiful kitty">
    </noscript>
</div>
Responsive Images
HiSRC
Usa JavaScript com jQuery, semântico, testa bandwidth, requer markup extra na tag <img>
https://github.com/teleject/hisrc

Adaptive Images
Server-side, usa .htaccess e PHP
http://code.google.com/p/css3-mediaqueries-js/

Picturefill
Usa JavaScript, segue a proposta mais aceita entre developers sobre Responsive Images
(tag <picture>)
https://github.com/scottjehl/picturefill

Outros
O Chris Coyier, do CSS-Tricks, fez um excelente comparativo entre as diferentes técnicas
(link em inglês)
http://css-tricks.com/which-responsive-images-solution-should-you-use/
WARNING
Nenhuma Media Query funciona no IE6–8 sem plugin. =/
Fallback para IE
Obrigado!
@shiota | www.eshiota.com

Contenu connexe

Tendances

Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Paulo Ragonha
 
前端MVC 豆瓣说
前端MVC 豆瓣说前端MVC 豆瓣说
前端MVC 豆瓣说
Ting Lv
 

Tendances (20)

Browsers with Wings
Browsers with WingsBrowsers with Wings
Browsers with Wings
 
Image Manipulation in WordPress 3.5 - WordCamp Phoenix 2013
Image Manipulation in WordPress 3.5 - WordCamp Phoenix 2013Image Manipulation in WordPress 3.5 - WordCamp Phoenix 2013
Image Manipulation in WordPress 3.5 - WordCamp Phoenix 2013
 
Componentization css angular
Componentization css angularComponentization css angular
Componentization css angular
 
DrupalCon jQuery
DrupalCon jQueryDrupalCon jQuery
DrupalCon jQuery
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
 
Images and PWA in magento
Images and PWA in magentoImages and PWA in magento
Images and PWA in magento
 
Using Renderless Components in Vue.js during your software development.
Using Renderless Components in Vue.js during your software development.Using Renderless Components in Vue.js during your software development.
Using Renderless Components in Vue.js during your software development.
 
Creating GUI Component APIs in Angular and Web Components
Creating GUI Component APIs in Angular and Web ComponentsCreating GUI Component APIs in Angular and Web Components
Creating GUI Component APIs in Angular and Web Components
 
Creating GUI container components in Angular and Web Components
Creating GUI container components in Angular and Web ComponentsCreating GUI container components in Angular and Web Components
Creating GUI container components in Angular and Web Components
 
前端MVC 豆瓣说
前端MVC 豆瓣说前端MVC 豆瓣说
前端MVC 豆瓣说
 
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
 
Ext JS Architecture Best Practices - Mitchell Simeons
Ext JS Architecture Best Practices - Mitchell SimeonsExt JS Architecture Best Practices - Mitchell Simeons
Ext JS Architecture Best Practices - Mitchell Simeons
 
AngularJS vs. Ember.js vs. Backbone.js
AngularJS vs. Ember.js vs. Backbone.jsAngularJS vs. Ember.js vs. Backbone.js
AngularJS vs. Ember.js vs. Backbone.js
 
Intro to Ember.js
Intro to Ember.jsIntro to Ember.js
Intro to Ember.js
 
Cheap frontend tricks
Cheap frontend tricksCheap frontend tricks
Cheap frontend tricks
 
Making your Angular.js Application accessible
Making your Angular.js Application accessibleMaking your Angular.js Application accessible
Making your Angular.js Application accessible
 
SenchaCon 2016: Want to Use Ext JS Components with Angular 2? Here’s How to I...
SenchaCon 2016: Want to Use Ext JS Components with Angular 2? Here’s How to I...SenchaCon 2016: Want to Use Ext JS Components with Angular 2? Here’s How to I...
SenchaCon 2016: Want to Use Ext JS Components with Angular 2? Here’s How to I...
 
Polymer 1.0
Polymer 1.0Polymer 1.0
Polymer 1.0
 
How to Build SPA with Vue Router 2.0
How to Build SPA with Vue Router 2.0How to Build SPA with Vue Router 2.0
How to Build SPA with Vue Router 2.0
 
Intro to Ember.JS 2016
Intro to Ember.JS 2016Intro to Ember.JS 2016
Intro to Ember.JS 2016
 

Similaire à Responsive Web Design e a Ubiquidade da Web

Lect-4-Responsive-Web-06032024-082044am.pptx
Lect-4-Responsive-Web-06032024-082044am.pptxLect-4-Responsive-Web-06032024-082044am.pptx
Lect-4-Responsive-Web-06032024-082044am.pptx
zainm7032
 
Rapid Prototyping
Rapid PrototypingRapid Prototyping
Rapid Prototyping
Even Wu
 
The specs behind the sex, mobile-friendly layout beyond the desktop
The specs behind the sex, mobile-friendly layout beyond the desktopThe specs behind the sex, mobile-friendly layout beyond the desktop
The specs behind the sex, mobile-friendly layout beyond the desktop
betabeers
 
Building the new AppExchange using Responsive Design
Building the new AppExchange using Responsive DesignBuilding the new AppExchange using Responsive Design
Building the new AppExchange using Responsive Design
Salesforce Developers
 

Similaire à Responsive Web Design e a Ubiquidade da Web (20)

Pinkoi Mobile Web
Pinkoi Mobile WebPinkoi Mobile Web
Pinkoi Mobile Web
 
Lect-4-Responsive-Web-06032024-082044am.pptx
Lect-4-Responsive-Web-06032024-082044am.pptxLect-4-Responsive-Web-06032024-082044am.pptx
Lect-4-Responsive-Web-06032024-082044am.pptx
 
Responsive design
Responsive designResponsive design
Responsive design
 
Intro to @viewport & other new Responsive Web Design CSS features
Intro to @viewport & other new Responsive Web Design CSS featuresIntro to @viewport & other new Responsive Web Design CSS features
Intro to @viewport & other new Responsive Web Design CSS features
 
Responsive Web in Brief
Responsive Web in BriefResponsive Web in Brief
Responsive Web in Brief
 
Responsive Websites
Responsive WebsitesResponsive Websites
Responsive Websites
 
Adaptive theming using compass susy grid
Adaptive theming using compass susy gridAdaptive theming using compass susy grid
Adaptive theming using compass susy grid
 
Rapid Prototyping
Rapid PrototypingRapid Prototyping
Rapid Prototyping
 
The specs behind the sex, mobile-friendly layout beyond the desktop
The specs behind the sex, mobile-friendly layout beyond the desktopThe specs behind the sex, mobile-friendly layout beyond the desktop
The specs behind the sex, mobile-friendly layout beyond the desktop
 
Building the new AppExchange using Responsive Design
Building the new AppExchange using Responsive DesignBuilding the new AppExchange using Responsive Design
Building the new AppExchange using Responsive Design
 
Web Development for Mobile: GTUG Talk at Google
Web Development for Mobile: GTUG Talk at GoogleWeb Development for Mobile: GTUG Talk at Google
Web Development for Mobile: GTUG Talk at Google
 
Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)
 
Formatting Images with CSS in MadCap Flare - MadCap webinar, Scott DeLoach, C...
Formatting Images with CSS in MadCap Flare - MadCap webinar, Scott DeLoach, C...Formatting Images with CSS in MadCap Flare - MadCap webinar, Scott DeLoach, C...
Formatting Images with CSS in MadCap Flare - MadCap webinar, Scott DeLoach, C...
 
Adobe MAX 2008: HTML/CSS + Fireworks
Adobe MAX 2008: HTML/CSS + FireworksAdobe MAX 2008: HTML/CSS + Fireworks
Adobe MAX 2008: HTML/CSS + Fireworks
 
HTML5 and CSS3: Exploring Mobile Possibilities - London Ajax Mobile Event
HTML5 and CSS3: Exploring Mobile Possibilities - London Ajax Mobile EventHTML5 and CSS3: Exploring Mobile Possibilities - London Ajax Mobile Event
HTML5 and CSS3: Exploring Mobile Possibilities - London Ajax Mobile Event
 
Responsive layouts by Maqbool
Responsive layouts by MaqboolResponsive layouts by Maqbool
Responsive layouts by Maqbool
 
HTML5, the new buzzword
HTML5, the new buzzwordHTML5, the new buzzword
HTML5, the new buzzword
 
Retro Responsive: From Fixed-Width to Flexible in 55 Minutes
Retro Responsive: From Fixed-Width to Flexible in 55 MinutesRetro Responsive: From Fixed-Width to Flexible in 55 Minutes
Retro Responsive: From Fixed-Width to Flexible in 55 Minutes
 
Adaptive layouts - standards>next Manchester 23.03.2011
Adaptive layouts - standards>next Manchester 23.03.2011Adaptive layouts - standards>next Manchester 23.03.2011
Adaptive layouts - standards>next Manchester 23.03.2011
 
Responsive web design
Responsive web designResponsive web design
Responsive web design
 

Plus de Eduardo Shiota Yasuda

Criando uma arquitetura de front-end do zero
Criando uma arquitetura de front-end do zeroCriando uma arquitetura de front-end do zero
Criando uma arquitetura de front-end do zero
Eduardo Shiota Yasuda
 

Plus de Eduardo Shiota Yasuda (12)

Front-end Culture @ Booking.com
Front-end Culture @ Booking.comFront-end Culture @ Booking.com
Front-end Culture @ Booking.com
 
The anatomy of an A/B Test - JSConf Colombia Workshop
The anatomy of an A/B Test - JSConf Colombia WorkshopThe anatomy of an A/B Test - JSConf Colombia Workshop
The anatomy of an A/B Test - JSConf Colombia Workshop
 
Dominating the Web Typography
Dominating the Web TypographyDominating the Web Typography
Dominating the Web Typography
 
Internationalisation: 2200+ different ways to view a website
Internationalisation: 2200+ different ways to view a websiteInternationalisation: 2200+ different ways to view a website
Internationalisation: 2200+ different ways to view a website
 
Web Audio Band - Playing with a band in your browser
Web Audio Band - Playing with a band in your browserWeb Audio Band - Playing with a band in your browser
Web Audio Band - Playing with a band in your browser
 
RetroJS - Escrevendo músicas da era 8-bits com JavaScript e Web Audio API
RetroJS - Escrevendo músicas da era 8-bits com JavaScript e Web Audio APIRetroJS - Escrevendo músicas da era 8-bits com JavaScript e Web Audio API
RetroJS - Escrevendo músicas da era 8-bits com JavaScript e Web Audio API
 
Criando uma arquitetura de front-end do zero
Criando uma arquitetura de front-end do zeroCriando uma arquitetura de front-end do zero
Criando uma arquitetura de front-end do zero
 
Baby.com.br: Analisando, adaptando e melhorando a arquitetura da informação e...
Baby.com.br: Analisando, adaptando e melhorando a arquitetura da informação e...Baby.com.br: Analisando, adaptando e melhorando a arquitetura da informação e...
Baby.com.br: Analisando, adaptando e melhorando a arquitetura da informação e...
 
Desafios do Desenvolvimento de Front-end em um e-commerce
Desafios do Desenvolvimento de Front-end em um e-commerceDesafios do Desenvolvimento de Front-end em um e-commerce
Desafios do Desenvolvimento de Front-end em um e-commerce
 
User Experience para Developers
User Experience para DevelopersUser Experience para Developers
User Experience para Developers
 
Sushi e Interfaces - PechaKucha São Paulo Vol. 8 + Inspire Japan
Sushi e Interfaces - PechaKucha São Paulo Vol. 8 + Inspire JapanSushi e Interfaces - PechaKucha São Paulo Vol. 8 + Inspire Japan
Sushi e Interfaces - PechaKucha São Paulo Vol. 8 + Inspire Japan
 
O Design e a Interface no mundo da Programação
O Design e a Interface no mundo da ProgramaçãoO Design e a Interface no mundo da Programação
O Design e a Interface no mundo da Programação
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Dernier (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
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
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
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
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 

Responsive Web Design e a Ubiquidade da Web

  • 1. Responsive Web Design e a ubiquidade da web Eduardo Shiota Yasuda @shiota | www.eshiota.com
  • 2. Uma (breve) História do Design na Web
  • 3. Tim Berners-Lee Pai do HTTP, HTML, diretor da W3C, e cavaleiro.
  • 4. Primeira página da Web http://www.w3.org/History/19921103-hypertext/hypertext/WWW/TheProject.html
  • 5. Primeira Página do UOL 23/12/1996 - archive.org
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. EVIL
  • 12.
  • 13. HTML » Print » Table » Tableless » Standards » ?
  • 17. Jeremy Keith's — @adactio — Instagram
  • 18. HTML » Print » Table » Tableless » Standards » Responsive Web Design
  • 19. Responsive Web Design Solução agnóstica à plataforma, browser e dispositivo
  • 20. UOL Close, but no cigar. Desktop iPad Portrait iPad Landscape iPhone iPhone Portrait Landscape
  • 21. UOL Close, but no cigar. Desktop Desktop?
  • 22. The Boston Globe Responsivelicious Desktop iPad Portrait iPad Landscape iPhone iPhone Portrait Landscape
  • 23. 1. Design flexível + 2. Media Queries + 3. Ajustes e plugins
  • 24.
  • 25. Flexible Web Design Tipografia, grid & conteúdo
  • 26. Golden rule Target ÷ Contexto = Dimensão
  • 27. Tipografia `em`
  • 28.
  • 29. 70px/80px 24px/32px 14px/21px
  • 30. body { font: normal normal 14px/21px "cabin", sans-serif; } .headline h1 { font: normal bold 70px/80px "enriqueta", serif; } .headline p { font-size: 24px; line-height: 32px; }
  • 31. body » font-size: 100% (16px na maioria dos browsers)
  • 32. body { font: normal normal 100%/1.5 "cabin", sans-serif; }
  • 33. target (70px) target (24px) CONTEXTO » body (16px) target (14px)
  • 34. Target ÷ Contexto = Dimensão 70px ÷ 16px = 4.375em 80px ÷ 70px = 1.142857143 24px ÷ 16px = 1.5em 32px ÷ 24px = 1.333333
  • 35. body { font: normal normal 100%/1.5 "cabin", sans-serif; } .headline h1 { /* 70px ÷ 16px & 80px ÷ 70px */ font: normal bold 4.375em/1.142857143 "enriqueta", serif; } .headline p { font-size: 1.5em; /* 24px ÷ 16px */ line-height: 1.333333; /* 32px ÷ 24px */ } .blog-post .post-content { font-size: .875em; /* 14px ÷ 16px */ }
  • 37. 1000px 65px 20px 660px 320px
  • 38. #container { width: 1000px; } .main-content { float: left; width: 660px; margin-right: 20px; } .side-content { float: left; width: 320px; }
  • 39. Contexto (1000px) Target (65px) Target (20px) Target (660px) Target (320px)
  • 40. Target ÷ Contexto = Dimensão 1000px = 100% 660px ÷ 1000px = 66% 20px ÷ 1000px = 2% 320px ÷ 1000px = 32%
  • 41. #container { width: 100%; } .main-content { float: left; width: 66%; /* 660px ÷ 1000px */ margin-right: 2%; /* 20px ÷ 1000px */ } .side-content { float: left; width: 32%; /* 32px ÷ 1000px */ }
  • 42. Conteúdo max-width: 100% img, embed, object, video (IE6 => width: 100%)
  • 43. 525px 210px
  • 44. .blog-post .alignright { float: right; margin: 0 0 20px 16px; } .blog-post .alignright img { /* + 2px border + 2px padding = 210px */ width: 206px; }
  • 45. Contexto (525px) Target (210px)
  • 46. Target ÷ Contexto = Dimensão 210px ÷ 525px = 40%
  • 47. .blog-post .alignright { float: right; margin: 0 0 20px 16px; width: 40%; } .blog-post .alignright img { max-width: 100%; -moz-box-sizing: border-box; box-sizing: border-box; }
  • 48.
  • 49.
  • 50. $(function () { $(“#site-content”).find(“.main-content”).fitVids(); });
  • 51.
  • 52.
  • 53. $(function () { $(“#site-content”).find(“.main-content”).fitVids(); // FitText's formula: // // fontSize = elementWidth / (compressor * 10) // fontSize = 70 // elementWidth = 1000 // compressor = 100/70 = 1.428571429 $("#site-content") .find(".headline h1") .fitText(1.428571429, { minFontSize: "36px", maxFontSize: "96px" }); });
  • 54. Media Queries Tipos e features
  • 55. Tipos all, braille, embossed, handheld, print, projection, screen, speech, tty, tv Features color (min | max-)width color-index grid (min | max-)aspect-ratio monochrome (min | max-)device-aspect-ratio orientation (min | max-)device-height (min | max-)resolution (min | max-)device-width scan (min | max-)height -webkit-(min | max-)device-pixel-ratio
  • 56. Sintaxe [only | not]? {tipo} and ({feature}[:{valor}]?) [and ({feature}[:{valor}]?)]* [, [only | not]? {tipo} and ({feature}: [:{valor}]?) [and ({feature}[:{valor}]?)]* ] Uso <link rel=”stylesheet” href=”wide.css” media=”screen and (min-width:1200px)” /> ou @media screen and (max-width: 1200px) { /* insert styles here */ }
  • 57. Exemplos @media print and (max-width:21cm) {} @media all and (max-width: 1024px) {} @media only screen and (orientation:landscape) and (min-device-width:768px) and (max-device-width:1024px), only screen and (-webkit-device-aspect-ratio:1.5) {}
  • 58. Exemplos @media only screen and (orientation:landscape) and (min-device-width:768px) and (max-device-width:1024px), only screen and (-webkit-device-aspect-ratio:1.5) {} device-width: 1024px -webkit-device-aspect-ratio: 1.5 (novo iPad) device-height: 768px orientation: landscape
  • 59. @media screen and (max-width: 1024px) { // Diminuir a fonte do menu } @media screen and (max-width: 960px) { // Diminuir Header, logo e H2 // Galeria de fotos em 3 colunas // Nav fixo à esquerda // Search input maior } @media screen and (max-width: 840px) { // Diminuir H2, nav e campo de busca // Formatação de data simples } @media screen and (max-width: 767px) { // Uma coluna ao invés de duas }
  • 60. Retina Display The New iPad™, iPhone 4(S), The Next Generation MacBook Pro with Retina Display™
  • 61. 16 x 1 physical pixels 16 x 1 virtual pixels device-pixel-ratio: 1 Normal displays 32 x 2 physical pixels 16 x 1 virtual pixels device-pixel-ratio: 2 “Retina” displays
  • 62. Display: Mostra physical pixels CSS: Interpreta virtual pixels
  • 63. Physical Pixels: Imagens 4x maiores (2x width / 2x height) Virtual Pixels: Dimensões virtuais, imagens redimensionadas
  • 65. Normal display sprite.png 130px 260px
  • 66. Normal display #site-header h1 a { display: block; width: 240px; height: 57px; background-image: url(../images/sprite.png); background-repeat: no-repeat; background-position: -10px -10px; overflow: hidden; text-indent: 100%; white-space: nowrap; }
  • 67. “Retina” display sprite@2x.png 260px 520px
  • 68. “Retina” display @media screen and (-webkit-min-device-pixel-ratio: 2) { #site-header h1 a { width: 240px; /* Virtual pixels, continua igual */ height: 57px; /* Virtual pixels, continua igual */ background-image: url(../images/sprite@2x.png); background-position: -10px -10px; /* Virtual pixels, continua igual */ -webkit-background-size: 50% 50%; /* Dimensionando os Physical */ -moz-background-size: 50% 50%; /* Pixels da imagem para os */ -ms-background-size: 50% 50%; /* Virtual Pixels do browser */ -o-background-size: 50% 50%; background-size: 50% 50%; overflow: hidden; text-indent: 100%; white-space: nowrap; } }
  • 69. “Retina” display @media screen and (-webkit-min-device-pixel-ratio: 2) { #site-header h1 a { background-image: url(../images/sprite@2x.png); -webkit-background-size: 50% 50%; -moz-background-size: 50% 50%; -ms-background-size: 50% 50%; -o-background-size: 50% 50%; background-size: 50% 50%; } }
  • 71.
  • 73. FAIL
  • 74.
  • 75. <div data-picture data-alt="A beautiful kitty"> <div data-src="jamie_small.jpg"></div> <div data-src="jamie_medium.jpg" data-media="(min-width: 400px)"></div> <div data-src="jamie_large.jpg" data-media="(min-width: 800px)"></div> <div data-src="jamie_extralarge.jpg" data-media="(min-width: 1000px)"></div> <!-- Fallback content for non-JS browsers. --> <noscript> <img src="external/imgs/jamie_small.jpg" alt="A beautiful kitty"> </noscript> </div>
  • 76. Responsive Images HiSRC Usa JavaScript com jQuery, semântico, testa bandwidth, requer markup extra na tag <img> https://github.com/teleject/hisrc Adaptive Images Server-side, usa .htaccess e PHP http://code.google.com/p/css3-mediaqueries-js/ Picturefill Usa JavaScript, segue a proposta mais aceita entre developers sobre Responsive Images (tag <picture>) https://github.com/scottjehl/picturefill Outros O Chris Coyier, do CSS-Tricks, fez um excelente comparativo entre as diferentes técnicas (link em inglês) http://css-tricks.com/which-responsive-images-solution-should-you-use/
  • 77. WARNING Nenhuma Media Query funciona no IE6–8 sem plugin. =/
  • 79.
  • 80.