SlideShare a Scribd company logo
RESPONSIVE WEB
DESIGN: TIPS AND
TRICKS
Gautam Krishnan
http://www.gautamkrishnan.com
CONTENTS
• Introduction
•
•
•
•
•
•
•
•

1. Simple DOM structure
2. Media Queries
3. Breakpoints
4. Box-sizing
5. Max and min properties
6. Em and Rem units
7. Meta tags on your page
8. Eliminating touch delays

• 9. Bring native scrolling to your
web app
• 10. Backface-visibility
• 11. Lesser jQuery bindings
• 12. Avoiding hover states
• 13. Avoid using orientation in
media queries
• 14. Relative design
• Thank you!
INTRODUCTION

I recently worked on an application (Zoho Pulse) and made the
application responsive for mobile and tablet devices. The website was
previously built for web, and I had to face a lot of challenges to make it
responsive. Here are some of the stuff I learnt while making it, and if
you are working on responsive design, you should probably keep this
as reference.
1. SIMPLE DOM STRUCTURE

• This is perhaps the most basic of them all - keep it simple. Complex
DOM means a complex layout, which means a lot more burden for
you. It also would mean that the interaction and scroll will become
sluggish - an effect you don't want. Divide your website into proper
sections (like a header, left navigation pane, content area, etc.)

Recommended for you

Responsive Enhancement
Responsive EnhancementResponsive Enhancement
Responsive Enhancement

Responsive Webdesign is much more than squishing containers and setting breakpoints. Performance is often a big problem. How to achieve performance with progressive enhancement, conditional loading and RESS. Original Slideshow: http://maddesigns.de/responsive-enhancement/

rwdresponsive web designress
Responsive and Fast
Responsive and FastResponsive and Fast
Responsive and Fast

This document discusses strategies for improving website performance. It begins by showing examples of slow loading pages and notes that responsive web design (RWD) does not inherently improve performance—proper implementation is important. Several tips for optimizing performance are provided, such as concatenating files, minifying code, compressing images, using responsive images, optimizing font and image sizes, and inlining critical CSS. The document also covers topics like bandwidth versus latency, measuring performance, and how HTTP/2 may impact current best practices. The overarching message is that performance should be a priority considered throughout the design and development process.

wporwdperformance
Optimizing Sites for Mobile Devices
Optimizing Sites for Mobile DevicesOptimizing Sites for Mobile Devices
Optimizing Sites for Mobile Devices

Slides for my Adobe MAX 2011 presentation on Optimizing Sites for Mobile Devices. In this hands-on lab, I explore the concept of developing a mobile strategy that approaches mobile as an equal partner in the design process, and explores techniques to help site content deploy across devices and contexts.

media queriesmobileoptimizing
2. MEDIA QUERIES

• Media queries in CSS adjust the content based on width of the
device. Choose to display/hide content using media queries. Make
sure that only the most important content of your page is displayed
on mobile devices. You can hide everything else that you feel are
not-so-important.
3. BREAKPOINTS
Make sure you have the right media query breakpoints for standard
devices. Uneven breakpoints would make your website behave oddly
in different devices which might nearly be of the same display
resolution but above/below the breakpoint.
Here is a list of common breakpoints borrowed from the Foundation
framework by Zurb, in the next slide -
// Small screens
@media only screen { } /* Define mobile styles */
@media only screen and (max-width: 40em) { } /* max-width 640px, mobile-only styles, use when QAing mobile issues */
// Medium screens
@media only screen and (min-width: 40.063em) { } /* min-width 641px, medium screens */
@media only screen and (min-width: 40.063em) and (max-width: 64em) { } /* min-width 641px and max-width 1024px, use
when QAing tablet-only issues */
// Large screens
@media only screen and (min-width: 64.063em) { } /* min-width 1025px, large screens */
@media only screen and (min-width: 64.063em) and (max-width: 90em) { } /* min-width 1024px and max-width 1440px, use
when QAing large screen-only issues */
// XLarge screens
@media only screen and (min-width: 90.063em) { } /* min-width 1441px, xlarge screens */
@media only screen and (min-width: 90.063em) and (max-width: 120em) { } /* min-width 1441px and max-width 1920px, use
when QAing xlarge screen-only issues */
// XXLarge screens
@media only screen and (min-width: 120.063em) { } /* min-width 1921px, xlarge screens */
4. BOX-SIZING

• You probably know this property, but you will start appreciating it more while
using it in responsive design. It helps you control the size of your divs even
while resized. Box-sizing: border-box property gels the width, padding and
border properties of the element within the specified width. In other words,
the padding and border are 'inset'.

Recommended for you

Front End Best Practices
Front End Best PracticesFront End Best Practices
Front End Best Practices

Front End Best Practices: A Selection of Best Practices, Tips, Tricks & Good Advice For Today’s Front End Development. Practices mentioned in this presentation range from basic principles to more advanced tools and techniques. By Holger Bartel for WomenWhoCodeHK 23/07/2014

developmentcssfrontend
Modern Front-End Development
Modern Front-End DevelopmentModern Front-End Development
Modern Front-End Development

A talk on front-end developer tools including Yeoman, Grunt.js, Require.js, Bower, and SASS given at Drupal Camp LA 2013. This talk doesn't address Drupal specifically, but it was aimed to give the audience of drupal developers a look into the state of the art.

require.jsyeomanbower
Whirlwind Tour of SVG (plus RaphaelJS)
Whirlwind Tour of SVG (plus RaphaelJS)Whirlwind Tour of SVG (plus RaphaelJS)
Whirlwind Tour of SVG (plus RaphaelJS)

Marc Grabanski gave a whirlwind tour of Scalable Vector Graphics (SVG), covering the basics of SVG including elements, embedding SVG, features like DOM structure and filters, demos of transformations and animation, and tools like RaphaelJS. The presentation provided an overview of SVG and highlighted its advantages like scalability, accessibility, and use of HTML and CSS. Examples of various SVG elements, embedding methods, and features like filters and transformations were demonstrated.

raphaeljssvgvector graphics
5. MAX AND MIN PROPERTIES

• The max-width, max-height, min-width and min-height properties limit
the maximum or minimum height/width of the element. Enough said.
6. EM AND REM UNITS
If your website is zoomable, the clarity of your fonts may be lost if you
have specified the fonts in px units. It is well known to specify font
sizes in ems. But what does it mean?
"If you define a font-size as 1em (font-size:1em;) you are telling the browser to set the font height to the
same height as the parent element default height."

Rems are different from ems in one distinct way – ems use the
containers font size to calculate, whereas rems are root based, I.E
they use the HTML font-size as the base to calculate from.
7. META TAGS ON YOUR PAGE
I use this:
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, userscalable=0, minimum-scale=1.0, maximum-scale=1.0">

It indicates that the height and width must be of that of the device, the zoom must be set to 100%, and
must not be allowed to be zoomed in or out by the user.
<meta name="apple-mobile-web-app-capable" content="yes" />

If content is set to yes, the web application runs in full-screen mode; otherwise, it does not. The default
behavior is to use Safari to display web content. You can determine whether a webpage is displayed in
full-screen mode using the window.navigator.standalone read-only Boolean JavaScript property.
8. ELIMINATING TOUCH DELAYS

• Touch devices have a delay of nearly 300ms to allow double click.
Anything more than 50ms as a negative impact and makes your app
look sluggish as it takes time to respond. To eliminate this click
delay, you can use the Fastclick plugin: ftlabs.github.io/fastclick/

Recommended for you

Fundamental JQuery
Fundamental JQueryFundamental JQuery
Fundamental JQuery

This document provides an overview and agenda for a jQuery training session. It introduces jQuery as a JavaScript library that simplifies tasks like HTML document manipulation. It then covers various jQuery basics like selectors and events. The document also summarizes how jQuery can be used for animations, scrolling, forms, images, and more. Examples are given throughout to illustrate jQuery concepts and APIs.

jquerytrainingintroduction to jquery
Accessibility - A feature you can build
Accessibility - A feature you can buildAccessibility - A feature you can build
Accessibility - A feature you can build

From jQuery San Diego, held Feb 12-13 2014, my talk on web accessibility for web developers. I cover basic techniques, introduce screen readers and ARIA, and go over testing. The goal is to demystify accessibility so we can weave it in to applications today.

a11yaccessibilityjquery san diego
Responsive & Responsible Web Design in DNN
Responsive & Responsible Web Design in DNNResponsive & Responsible Web Design in DNN
Responsive & Responsible Web Design in DNN

DNN is an excellent platform for a responsive website, but its important to know the ''Do's'' and ''Don'ts'' when designing responsively. This presentation will cover all things responsive: from wireframes and mockups, to media queries and javascript snippets. Get valuable tips on how to create a responsive site following modern web standards, while harnessing the power of the DNN framework. Learn how to design and plan your site, develop layouts with a fluid grid, and test to ensure your site looks great on tons of devices!

web designdotnetnukeresponsive web design
9. BRING NATIVE SCROLLING TO YOUR
WEB APP
Mobile browsers do not scroll content like a native web application
does. The 'momentum' or 'kinetic' scroll that your phone provides for
apps isn't provided for browsers. To use this, you need to add a CSS
property in your scrolling container:

webkit-overflow-scrolling: touch;
10. BACKFACE-VISIBILITY
The backface-visibility property defines whether or not an element should be visible when
not facing the screen. This property is useful when an element is rotated, and you do not
want to see its backside. However, it is known to crash Safari in iPhone and iPad, so it is
better to avoid this property.
Some more information on this here:
http://dontwakemeup.com/webkit-backface-visibility-and-browser-crashing/
http://stackoverflow.com/questions/16166849/ios-multiple-divs-with-webkit-backfacevisibilityhidden-crash-browser-when-zo
https://discussions.apple.com/thread/5397323?start=75&tstart=0
11. LESSER JQUERY BINDINGS

• More jQuery bindings would mean that you are increasing the initial
loading time and the DOM becomes heavier, also the performance
and response is affected. It is generally advisable to use lesser
jQuery bindings and use plain JavaScript instead.
12. AVOIDING HOVER STATES
• If you find your website to be sluggish while scrolling, the single main
reason would be the :hover selector in CSS. When you scroll on
content that has a hover state, the browser mistakes the touchstart
of scroll to be that of a hover state. Instead of scrolling the content, it
shows you the hover state of the element, which makes the scroll
look sluggish. Avoid hover states wherever possible and the best
suggestion would be to gather all hover statements into a single file
and not loading it for mobile devices.

Recommended for you

[edUi] HTML5 Workshop
[edUi] HTML5 Workshop[edUi] HTML5 Workshop
[edUi] HTML5 Workshop

This document provides an agenda for an HTML5 workshop. The agenda includes discussions of differences between HTML5 and XHTML, building with HTML5 syntax like DOCTYPEs and character sets, and features like audio/video, geolocation, forms, and accessibility. It also outlines exercises for validating HTML5 markup and exploring new HTML5 elements.

htmlhtml5eduiconf
State of jQuery June 2013 - Portland
State of jQuery June 2013 - PortlandState of jQuery June 2013 - Portland
State of jQuery June 2013 - Portland

The jQuery Foundation coordinates work on the jQuery project, including code, documentation, infrastructure, and events. It is a non-profit organization funded by conferences, donations, and memberships. The Foundation maintains jQuery and related projects like jQuery UI, jQuery Mobile, and QUnit on GitHub. jQuery 1.x continues to support older browsers while jQuery 2.x supports modern browsers, with both versions maintaining API compatibility. Major releases in 2012 included jQuery 1.9 in January and jQuery 2.0 in April.

javascriptjquerylolcats
jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009

This document outlines a presentation on beginning jQuery. It introduces jQuery, its history and core team. It also covers how to set up jQuery and explains its core functionality, including selecting elements, manipulating the DOM, AJAX, and events.

conference2009jqcon
13. AVOID USING ORIENTATION IN
MEDIA QUERIES:
@media screen and (orientation:portrait)
@media screen and (orientation:landscape)
These statements in media queries allow you to define styles
specifically for portrait or landscape orientations. It is, however known
to cause problems in Android when the "focus" event of input boxes is
fired. Sometimes, the whole layout goes beserk.
14. RELATIVE DESIGN

• This is again the basics of responsive design revisited. Try to specify
all widths and heights in %. It allows content to adjust automatically
to the available width/height.
THANK YOU!
• You can grab the text version of this and many more tips and tricks
on design and programming at my blog here:
http://geekaylabs.blogspot.in/
• Follow me on Twitter @gkthegr8.
• On the web: http://www.gautamkrishnan.com

More Related Content

What's hot

Responsive design: techniques and tricks to prepare your websites for the mul...
Responsive design: techniques and tricks to prepare your websites for the mul...Responsive design: techniques and tricks to prepare your websites for the mul...
Responsive design: techniques and tricks to prepare your websites for the mul...
Andreas Bovens
 
Web Development for UX Designers
Web Development for UX DesignersWeb Development for UX Designers
Web Development for UX Designers
Ashlimarie
 
Stop reinventing the wheel: Build Responsive Websites Using Bootstrap
Stop reinventing the wheel: Build Responsive Websites Using BootstrapStop reinventing the wheel: Build Responsive Websites Using Bootstrap
Stop reinventing the wheel: Build Responsive Websites Using Bootstrap
freshlybakedpixels
 
Responsive Enhancement
Responsive EnhancementResponsive Enhancement
Responsive Enhancement
Sven Wolfermann
 
Responsive and Fast
Responsive and FastResponsive and Fast
Responsive and Fast
Sven Wolfermann
 
Optimizing Sites for Mobile Devices
Optimizing Sites for Mobile DevicesOptimizing Sites for Mobile Devices
Optimizing Sites for Mobile Devices
jameswillweb
 
Front End Best Practices
Front End Best PracticesFront End Best Practices
Front End Best Practices
Holger Bartel
 
Modern Front-End Development
Modern Front-End DevelopmentModern Front-End Development
Modern Front-End Development
mwrather
 
Whirlwind Tour of SVG (plus RaphaelJS)
Whirlwind Tour of SVG (plus RaphaelJS)Whirlwind Tour of SVG (plus RaphaelJS)
Whirlwind Tour of SVG (plus RaphaelJS)
Marc Grabanski
 
Fundamental JQuery
Fundamental JQueryFundamental JQuery
Fundamental JQuery
Achmad Solichin
 
Accessibility - A feature you can build
Accessibility - A feature you can buildAccessibility - A feature you can build
Accessibility - A feature you can build
Monika Piotrowicz
 
Responsive & Responsible Web Design in DNN
Responsive & Responsible Web Design in DNNResponsive & Responsible Web Design in DNN
Responsive & Responsible Web Design in DNN
gravityworksdd
 
[edUi] HTML5 Workshop
[edUi] HTML5 Workshop[edUi] HTML5 Workshop
[edUi] HTML5 Workshop
Christopher Schmitt
 
State of jQuery June 2013 - Portland
State of jQuery June 2013 - PortlandState of jQuery June 2013 - Portland
State of jQuery June 2013 - Portland
dmethvin
 
jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009
Ralph Whitbeck
 
Responsive Design Tools & Resources
Responsive Design Tools & ResourcesResponsive Design Tools & Resources
Responsive Design Tools & Resources
Clarissa Peterson
 
[heweb11] HTML5 Makeover
[heweb11] HTML5 Makeover[heweb11] HTML5 Makeover
[heweb11] HTML5 Makeover
Christopher Schmitt
 
Front End Tooling and Performance - Codeaholics HK 2015
Front End Tooling and Performance - Codeaholics HK 2015Front End Tooling and Performance - Codeaholics HK 2015
Front End Tooling and Performance - Codeaholics HK 2015
Holger Bartel
 
To build a WordPress Theme: Wordcamp Denmark 2014
To build a WordPress Theme: Wordcamp Denmark 2014To build a WordPress Theme: Wordcamp Denmark 2014
To build a WordPress Theme: Wordcamp Denmark 2014
James Bonham
 
Roll Your Own CSS Framework
Roll Your Own CSS FrameworkRoll Your Own CSS Framework
Roll Your Own CSS Framework
Mike Aparicio
 

What's hot (20)

Responsive design: techniques and tricks to prepare your websites for the mul...
Responsive design: techniques and tricks to prepare your websites for the mul...Responsive design: techniques and tricks to prepare your websites for the mul...
Responsive design: techniques and tricks to prepare your websites for the mul...
 
Web Development for UX Designers
Web Development for UX DesignersWeb Development for UX Designers
Web Development for UX Designers
 
Stop reinventing the wheel: Build Responsive Websites Using Bootstrap
Stop reinventing the wheel: Build Responsive Websites Using BootstrapStop reinventing the wheel: Build Responsive Websites Using Bootstrap
Stop reinventing the wheel: Build Responsive Websites Using Bootstrap
 
Responsive Enhancement
Responsive EnhancementResponsive Enhancement
Responsive Enhancement
 
Responsive and Fast
Responsive and FastResponsive and Fast
Responsive and Fast
 
Optimizing Sites for Mobile Devices
Optimizing Sites for Mobile DevicesOptimizing Sites for Mobile Devices
Optimizing Sites for Mobile Devices
 
Front End Best Practices
Front End Best PracticesFront End Best Practices
Front End Best Practices
 
Modern Front-End Development
Modern Front-End DevelopmentModern Front-End Development
Modern Front-End Development
 
Whirlwind Tour of SVG (plus RaphaelJS)
Whirlwind Tour of SVG (plus RaphaelJS)Whirlwind Tour of SVG (plus RaphaelJS)
Whirlwind Tour of SVG (plus RaphaelJS)
 
Fundamental JQuery
Fundamental JQueryFundamental JQuery
Fundamental JQuery
 
Accessibility - A feature you can build
Accessibility - A feature you can buildAccessibility - A feature you can build
Accessibility - A feature you can build
 
Responsive & Responsible Web Design in DNN
Responsive & Responsible Web Design in DNNResponsive & Responsible Web Design in DNN
Responsive & Responsible Web Design in DNN
 
[edUi] HTML5 Workshop
[edUi] HTML5 Workshop[edUi] HTML5 Workshop
[edUi] HTML5 Workshop
 
State of jQuery June 2013 - Portland
State of jQuery June 2013 - PortlandState of jQuery June 2013 - Portland
State of jQuery June 2013 - Portland
 
jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009
 
Responsive Design Tools & Resources
Responsive Design Tools & ResourcesResponsive Design Tools & Resources
Responsive Design Tools & Resources
 
[heweb11] HTML5 Makeover
[heweb11] HTML5 Makeover[heweb11] HTML5 Makeover
[heweb11] HTML5 Makeover
 
Front End Tooling and Performance - Codeaholics HK 2015
Front End Tooling and Performance - Codeaholics HK 2015Front End Tooling and Performance - Codeaholics HK 2015
Front End Tooling and Performance - Codeaholics HK 2015
 
To build a WordPress Theme: Wordcamp Denmark 2014
To build a WordPress Theme: Wordcamp Denmark 2014To build a WordPress Theme: Wordcamp Denmark 2014
To build a WordPress Theme: Wordcamp Denmark 2014
 
Roll Your Own CSS Framework
Roll Your Own CSS FrameworkRoll Your Own CSS Framework
Roll Your Own CSS Framework
 

Similar to Responsive Web Design: Tips and Tricks

Responsive Web Design
Responsive Web DesignResponsive Web Design
Responsive Web Design
Julia Vi
 
Stc 2015 preparing legacy projects for responsive design - design issues
Stc 2015   preparing legacy projects for responsive design - design issuesStc 2015   preparing legacy projects for responsive design - design issues
Stc 2015 preparing legacy projects for responsive design - design issues
Neil Perlin
 
Mobile Best Practices
Mobile Best PracticesMobile Best Practices
Mobile Best Practices
mintersam
 
Responsive Web Design - more than just a buzzword
Responsive Web Design - more than just a buzzwordResponsive Web Design - more than just a buzzword
Responsive Web Design - more than just a buzzword
Russ Weakley
 
Responsive Web Design (HeadStart TechTalks)
Responsive Web Design (HeadStart TechTalks)Responsive Web Design (HeadStart TechTalks)
Responsive Web Design (HeadStart TechTalks)
Tirthesh Ganatra
 
Bootstrap Tutorial
Bootstrap Tutorial Bootstrap Tutorial
Bootstrap Tutorial
Luan Nguyen
 
Responsive UX - One size fits all @BigDesign conference #BigD12
Responsive UX - One size fits all   @BigDesign conference #BigD12Responsive UX - One size fits all   @BigDesign conference #BigD12
Responsive UX - One size fits all @BigDesign conference #BigD12
touchtitans
 
HTML and Responsive Design
HTML and Responsive Design HTML and Responsive Design
HTML and Responsive Design
Mindy McAdams
 
Eye candy for your iPhone
Eye candy for your iPhoneEye candy for your iPhone
Eye candy for your iPhone
Brian Shim
 
Angular js mobile jsday 2014 - Verona 14 may
Angular js mobile   jsday 2014 - Verona 14 mayAngular js mobile   jsday 2014 - Verona 14 may
Angular js mobile jsday 2014 - Verona 14 may
Luciano Amodio
 
Responsivedesign 7-3-2012
Responsivedesign 7-3-2012Responsivedesign 7-3-2012
Responsivedesign 7-3-2012
Thomas Carney
 
Great Responsive-ability Web Design
Great Responsive-ability Web DesignGreat Responsive-ability Web Design
Great Responsive-ability Web Design
Mike Wilcox
 
Responsive Web Designs
Responsive Web DesignsResponsive Web Designs
Responsive Web Designs
Nusrat Khanom
 
Html 5 mobile - nitty gritty
Html 5 mobile - nitty grittyHtml 5 mobile - nitty gritty
Html 5 mobile - nitty gritty
Mario Noble
 
How to Project-Manage and Implement a Responsive Website
How to Project-Manage and Implement a Responsive WebsiteHow to Project-Manage and Implement a Responsive Website
How to Project-Manage and Implement a Responsive Website
Jj Jurgens
 
Intro to Responsive
Intro to ResponsiveIntro to Responsive
Intro to Responsive
Tom Elliott
 
Dreamweaver CS6, jQuery, PhoneGap, mobile design
Dreamweaver CS6, jQuery, PhoneGap, mobile designDreamweaver CS6, jQuery, PhoneGap, mobile design
Dreamweaver CS6, jQuery, PhoneGap, mobile design
Dee Sadler
 
Jquery mobile
Jquery mobileJquery mobile
Jquery mobile
Predhin Sapru
 
Reboot-Typography.pptx reboot typography to help you in research
Reboot-Typography.pptx reboot typography to help you in researchReboot-Typography.pptx reboot typography to help you in research
Reboot-Typography.pptx reboot typography to help you in research
AadiChauhan2
 
Responsive websites. Toolbox
Responsive websites. ToolboxResponsive websites. Toolbox
Responsive websites. Toolbox
Wojtek Zając
 

Similar to Responsive Web Design: Tips and Tricks (20)

Responsive Web Design
Responsive Web DesignResponsive Web Design
Responsive Web Design
 
Stc 2015 preparing legacy projects for responsive design - design issues
Stc 2015   preparing legacy projects for responsive design - design issuesStc 2015   preparing legacy projects for responsive design - design issues
Stc 2015 preparing legacy projects for responsive design - design issues
 
Mobile Best Practices
Mobile Best PracticesMobile Best Practices
Mobile Best Practices
 
Responsive Web Design - more than just a buzzword
Responsive Web Design - more than just a buzzwordResponsive Web Design - more than just a buzzword
Responsive Web Design - more than just a buzzword
 
Responsive Web Design (HeadStart TechTalks)
Responsive Web Design (HeadStart TechTalks)Responsive Web Design (HeadStart TechTalks)
Responsive Web Design (HeadStart TechTalks)
 
Bootstrap Tutorial
Bootstrap Tutorial Bootstrap Tutorial
Bootstrap Tutorial
 
Responsive UX - One size fits all @BigDesign conference #BigD12
Responsive UX - One size fits all   @BigDesign conference #BigD12Responsive UX - One size fits all   @BigDesign conference #BigD12
Responsive UX - One size fits all @BigDesign conference #BigD12
 
HTML and Responsive Design
HTML and Responsive Design HTML and Responsive Design
HTML and Responsive Design
 
Eye candy for your iPhone
Eye candy for your iPhoneEye candy for your iPhone
Eye candy for your iPhone
 
Angular js mobile jsday 2014 - Verona 14 may
Angular js mobile   jsday 2014 - Verona 14 mayAngular js mobile   jsday 2014 - Verona 14 may
Angular js mobile jsday 2014 - Verona 14 may
 
Responsivedesign 7-3-2012
Responsivedesign 7-3-2012Responsivedesign 7-3-2012
Responsivedesign 7-3-2012
 
Great Responsive-ability Web Design
Great Responsive-ability Web DesignGreat Responsive-ability Web Design
Great Responsive-ability Web Design
 
Responsive Web Designs
Responsive Web DesignsResponsive Web Designs
Responsive Web Designs
 
Html 5 mobile - nitty gritty
Html 5 mobile - nitty grittyHtml 5 mobile - nitty gritty
Html 5 mobile - nitty gritty
 
How to Project-Manage and Implement a Responsive Website
How to Project-Manage and Implement a Responsive WebsiteHow to Project-Manage and Implement a Responsive Website
How to Project-Manage and Implement a Responsive Website
 
Intro to Responsive
Intro to ResponsiveIntro to Responsive
Intro to Responsive
 
Dreamweaver CS6, jQuery, PhoneGap, mobile design
Dreamweaver CS6, jQuery, PhoneGap, mobile designDreamweaver CS6, jQuery, PhoneGap, mobile design
Dreamweaver CS6, jQuery, PhoneGap, mobile design
 
Jquery mobile
Jquery mobileJquery mobile
Jquery mobile
 
Reboot-Typography.pptx reboot typography to help you in research
Reboot-Typography.pptx reboot typography to help you in researchReboot-Typography.pptx reboot typography to help you in research
Reboot-Typography.pptx reboot typography to help you in research
 
Responsive websites. Toolbox
Responsive websites. ToolboxResponsive websites. Toolbox
Responsive websites. Toolbox
 

Recently uploaded

Measuring the Impact of Network Latency at Twitter
Measuring the Impact of Network Latency at TwitterMeasuring the Impact of Network Latency at Twitter
Measuring the Impact of Network Latency at Twitter
ScyllaDB
 
Research Directions for Cross Reality Interfaces
Research Directions for Cross Reality InterfacesResearch Directions for Cross Reality Interfaces
Research Directions for Cross Reality Interfaces
Mark Billinghurst
 
How to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptxHow to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptx
Adam Dunkels
 
20240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 202420240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 2024
Matthew Sinclair
 
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptxRPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
SynapseIndia
 
20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf
Sally Laouacheria
 
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Chris Swan
 
Calgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptxCalgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptx
ishalveerrandhawa1
 
Comparison Table of DiskWarrior Alternatives.pdf
Comparison Table of DiskWarrior Alternatives.pdfComparison Table of DiskWarrior Alternatives.pdf
Comparison Table of DiskWarrior Alternatives.pdf
Andrey Yasko
 
Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...
BookNet Canada
 
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Bert Blevins
 
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdfBT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
Neo4j
 
find out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challengesfind out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challenges
huseindihon
 
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - MydbopsScaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Mydbops
 
20240705 QFM024 Irresponsible AI Reading List June 2024
20240705 QFM024 Irresponsible AI Reading List June 202420240705 QFM024 Irresponsible AI Reading List June 2024
20240705 QFM024 Irresponsible AI Reading List June 2024
Matthew Sinclair
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
KAMAL CHOUDHARY
 
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdfINDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
jackson110191
 
Cookies program to display the information though cookie creation
Cookies program to display the information though cookie creationCookies program to display the information though cookie creation
Cookies program to display the information though cookie creation
shanthidl1
 
How Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdfHow Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdf
HackersList
 
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALLBLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
Liveplex
 

Recently uploaded (20)

Measuring the Impact of Network Latency at Twitter
Measuring the Impact of Network Latency at TwitterMeasuring the Impact of Network Latency at Twitter
Measuring the Impact of Network Latency at Twitter
 
Research Directions for Cross Reality Interfaces
Research Directions for Cross Reality InterfacesResearch Directions for Cross Reality Interfaces
Research Directions for Cross Reality Interfaces
 
How to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptxHow to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptx
 
20240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 202420240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 2024
 
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptxRPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
 
20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf
 
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
 
Calgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptxCalgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptx
 
Comparison Table of DiskWarrior Alternatives.pdf
Comparison Table of DiskWarrior Alternatives.pdfComparison Table of DiskWarrior Alternatives.pdf
Comparison Table of DiskWarrior Alternatives.pdf
 
Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...
 
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
 
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdfBT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
 
find out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challengesfind out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challenges
 
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - MydbopsScaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
 
20240705 QFM024 Irresponsible AI Reading List June 2024
20240705 QFM024 Irresponsible AI Reading List June 202420240705 QFM024 Irresponsible AI Reading List June 2024
20240705 QFM024 Irresponsible AI Reading List June 2024
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
 
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdfINDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
 
Cookies program to display the information though cookie creation
Cookies program to display the information though cookie creationCookies program to display the information though cookie creation
Cookies program to display the information though cookie creation
 
How Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdfHow Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdf
 
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALLBLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
 

Responsive Web Design: Tips and Tricks

  • 1. RESPONSIVE WEB DESIGN: TIPS AND TRICKS Gautam Krishnan http://www.gautamkrishnan.com
  • 2. CONTENTS • Introduction • • • • • • • • 1. Simple DOM structure 2. Media Queries 3. Breakpoints 4. Box-sizing 5. Max and min properties 6. Em and Rem units 7. Meta tags on your page 8. Eliminating touch delays • 9. Bring native scrolling to your web app • 10. Backface-visibility • 11. Lesser jQuery bindings • 12. Avoiding hover states • 13. Avoid using orientation in media queries • 14. Relative design • Thank you!
  • 3. INTRODUCTION I recently worked on an application (Zoho Pulse) and made the application responsive for mobile and tablet devices. The website was previously built for web, and I had to face a lot of challenges to make it responsive. Here are some of the stuff I learnt while making it, and if you are working on responsive design, you should probably keep this as reference.
  • 4. 1. SIMPLE DOM STRUCTURE • This is perhaps the most basic of them all - keep it simple. Complex DOM means a complex layout, which means a lot more burden for you. It also would mean that the interaction and scroll will become sluggish - an effect you don't want. Divide your website into proper sections (like a header, left navigation pane, content area, etc.)
  • 5. 2. MEDIA QUERIES • Media queries in CSS adjust the content based on width of the device. Choose to display/hide content using media queries. Make sure that only the most important content of your page is displayed on mobile devices. You can hide everything else that you feel are not-so-important.
  • 6. 3. BREAKPOINTS Make sure you have the right media query breakpoints for standard devices. Uneven breakpoints would make your website behave oddly in different devices which might nearly be of the same display resolution but above/below the breakpoint. Here is a list of common breakpoints borrowed from the Foundation framework by Zurb, in the next slide -
  • 7. // Small screens @media only screen { } /* Define mobile styles */ @media only screen and (max-width: 40em) { } /* max-width 640px, mobile-only styles, use when QAing mobile issues */ // Medium screens @media only screen and (min-width: 40.063em) { } /* min-width 641px, medium screens */ @media only screen and (min-width: 40.063em) and (max-width: 64em) { } /* min-width 641px and max-width 1024px, use when QAing tablet-only issues */ // Large screens @media only screen and (min-width: 64.063em) { } /* min-width 1025px, large screens */ @media only screen and (min-width: 64.063em) and (max-width: 90em) { } /* min-width 1024px and max-width 1440px, use when QAing large screen-only issues */ // XLarge screens @media only screen and (min-width: 90.063em) { } /* min-width 1441px, xlarge screens */ @media only screen and (min-width: 90.063em) and (max-width: 120em) { } /* min-width 1441px and max-width 1920px, use when QAing xlarge screen-only issues */ // XXLarge screens @media only screen and (min-width: 120.063em) { } /* min-width 1921px, xlarge screens */
  • 8. 4. BOX-SIZING • You probably know this property, but you will start appreciating it more while using it in responsive design. It helps you control the size of your divs even while resized. Box-sizing: border-box property gels the width, padding and border properties of the element within the specified width. In other words, the padding and border are 'inset'.
  • 9. 5. MAX AND MIN PROPERTIES • The max-width, max-height, min-width and min-height properties limit the maximum or minimum height/width of the element. Enough said.
  • 10. 6. EM AND REM UNITS If your website is zoomable, the clarity of your fonts may be lost if you have specified the fonts in px units. It is well known to specify font sizes in ems. But what does it mean? "If you define a font-size as 1em (font-size:1em;) you are telling the browser to set the font height to the same height as the parent element default height." Rems are different from ems in one distinct way – ems use the containers font size to calculate, whereas rems are root based, I.E they use the HTML font-size as the base to calculate from.
  • 11. 7. META TAGS ON YOUR PAGE I use this: <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, userscalable=0, minimum-scale=1.0, maximum-scale=1.0"> It indicates that the height and width must be of that of the device, the zoom must be set to 100%, and must not be allowed to be zoomed in or out by the user. <meta name="apple-mobile-web-app-capable" content="yes" /> If content is set to yes, the web application runs in full-screen mode; otherwise, it does not. The default behavior is to use Safari to display web content. You can determine whether a webpage is displayed in full-screen mode using the window.navigator.standalone read-only Boolean JavaScript property.
  • 12. 8. ELIMINATING TOUCH DELAYS • Touch devices have a delay of nearly 300ms to allow double click. Anything more than 50ms as a negative impact and makes your app look sluggish as it takes time to respond. To eliminate this click delay, you can use the Fastclick plugin: ftlabs.github.io/fastclick/
  • 13. 9. BRING NATIVE SCROLLING TO YOUR WEB APP Mobile browsers do not scroll content like a native web application does. The 'momentum' or 'kinetic' scroll that your phone provides for apps isn't provided for browsers. To use this, you need to add a CSS property in your scrolling container: webkit-overflow-scrolling: touch;
  • 14. 10. BACKFACE-VISIBILITY The backface-visibility property defines whether or not an element should be visible when not facing the screen. This property is useful when an element is rotated, and you do not want to see its backside. However, it is known to crash Safari in iPhone and iPad, so it is better to avoid this property. Some more information on this here: http://dontwakemeup.com/webkit-backface-visibility-and-browser-crashing/ http://stackoverflow.com/questions/16166849/ios-multiple-divs-with-webkit-backfacevisibilityhidden-crash-browser-when-zo https://discussions.apple.com/thread/5397323?start=75&tstart=0
  • 15. 11. LESSER JQUERY BINDINGS • More jQuery bindings would mean that you are increasing the initial loading time and the DOM becomes heavier, also the performance and response is affected. It is generally advisable to use lesser jQuery bindings and use plain JavaScript instead.
  • 16. 12. AVOIDING HOVER STATES • If you find your website to be sluggish while scrolling, the single main reason would be the :hover selector in CSS. When you scroll on content that has a hover state, the browser mistakes the touchstart of scroll to be that of a hover state. Instead of scrolling the content, it shows you the hover state of the element, which makes the scroll look sluggish. Avoid hover states wherever possible and the best suggestion would be to gather all hover statements into a single file and not loading it for mobile devices.
  • 17. 13. AVOID USING ORIENTATION IN MEDIA QUERIES: @media screen and (orientation:portrait) @media screen and (orientation:landscape) These statements in media queries allow you to define styles specifically for portrait or landscape orientations. It is, however known to cause problems in Android when the "focus" event of input boxes is fired. Sometimes, the whole layout goes beserk.
  • 18. 14. RELATIVE DESIGN • This is again the basics of responsive design revisited. Try to specify all widths and heights in %. It allows content to adjust automatically to the available width/height.
  • 19. THANK YOU! • You can grab the text version of this and many more tips and tricks on design and programming at my blog here: http://geekaylabs.blogspot.in/ • Follow me on Twitter @gkthegr8. • On the web: http://www.gautamkrishnan.com