You can use percentages for both page elements and text. Ems are used for text,

Similar documents
Responsive Web Design (RWD) Best Practices Guide Version:

Responsive Web Design: Media Types/Media Queries/Fluid Images

Responsive Web Design. birds of feather

Building Responsive Layouts

Principles of Web Design 6 th Edition. Chapter 12 Responsive Web Design

IBM Worklight: Responsive Design for Mul8- Channel Applica8on Development

Responsive Web Design (RWD) Building a single web site for the desktop, tablet and smartphone

Going Beyond SAP ITS Mobile Apps to a Responsive Design Mobile Apps. JK (JayaKumar Pedapudi) Principal Consultant NTT DATA, Inc.

Designing HTML s for Use in the Advanced Editor

Responsive Design: Ben Callahan

Web Design Basics. Cindy Royal, Ph.D. Associate Professor Texas State University

Responsive Web Design for Drupal

GUIDE TO CODE KILLER RESPONSIVE S

RESPONSIVE DESIGN BY COMMUNIGATOR

We automatically generate the HTML for this as seen below. Provide the above components for the teaser.txt file.

RESPONSIVE DESIGN FOR MOBILE RENDERING

JJY s Joomla 1.5 Template Design Tutorial:

Campaign Guidelines and Best Practices

Building Responsive Websites with the Bootstrap 3 Framework

CREATING RESPONSIVE UI FOR WEB STORE USING CSS

01/42. Lecture notes. html and css

Web Browser. Fetches/displays documents from web servers. Mosaic 1993

Coding HTML Tips, Tricks and Best Practices

ART 379 Web Design. HTML, XHTML & CSS: Introduction, 1-2

White Paper Using PHP Site Assistant to create sites for mobile devices

One Page Everywhere. Fluid, Responsive Design with Semantic.gs

How to Properly Compose HTML Code : 1

Responsive web design Are we ready for the new age?

THE SAS OUTPUT DELIVERY SYSTEM: BOLDLY TAKE YOUR WEB PAGES WHERE THEY HAVE NEVER GONE BEFORE! CHEVELL PARKER, SAS INSTITUTE INC.

Chapter 8 More on Links, Layout, and Mobile Key Concepts. Copyright 2013 Terry Ann Morris, Ed.D

Responsive Web Design for Teachers. Exercise: Building a Responsive Page with the Fluid Grid Layout Feature

This document will describe how you can create your own, fully responsive. drag and drop template to use in the creator.

Responsive Web Design in Application Express

Designing HTML ers

Mobile Web Design with HTML5, CSS3, JavaScript and JQuery Mobile Training BSP-2256 Length: 5 days Price: $ 2,895.00

CIS 467/602-01: Data Visualization

Responsive Web Design

Creator Coding Guidelines Toolbox

HTML CSS Basic Structure. HTML Structure [Source Code] CSS Structure [Cascading Styles] DIV or ID Tags and Classes. The BOX MODEL

DESIGNING MOBILE FRIENDLY S

HTML TIPS FOR DESIGNING

Responsive Web Design

The Essential Guide to HTML Design

Web layout guidelines for daughter sites of Scotland s Environment

What is CSS? Official W3C standard for controlling presentation Style sheets rely on underlying markup structure

8 STEPS TO CODE KILLER RESPONSIVE S

Joostrap RWD Bootstrap Template

MAGENTO THEME SHOE STORE

HOW Interactive Design Conference 2013

Responsive Design Best Practices

Magento Responsive Theme Design

Treble: One Page Website. Step 8 - Responsive Web Design

RESPONSIVE DESIGN

Website Planning Checklist

Outline of CSS: Cascading Style Sheets

Responsive Design Fundamentals Chapter 1: Chapter 2: name content

How To Design A Website For The Decs

Basics of HTML (some repetition) Cascading Style Sheets (some repetition) Web Design

Let's Dig Into the Omega Theme October 27,

WP Popup Magic User Guide

Responsive Web Design Creative License

Essential HTML & CSS for WordPress. Mark Raymond Luminys, Inc mraymond@luminys.com

ICE: HTML, CSS, and Validation

Using HTML5 Pack for ADOBE ILLUSTRATOR CS5

ITNP43: HTML Lecture 4

Web Building Blocks. Joseph Gilbert User Experience Web Developer University of Virginia Library

Introduction to Adobe Dreamweaver CC

{color:blue; font-size: 12px;}

EUROPEAN COMPUTER DRIVING LICENCE / INTERNATIONAL COMPUTER DRIVING LICENCE WEB EDITING

Sizmek Formats. HTML5 Page Skin. Build Guide

MCH Strategic Data Best Practices Review

PLAYER DEVELOPER GUIDE

Understanding Responsive Web Design. A detailed look at the current state of mobile commerce site development options. Written By: Igor Nesmyanovich

CSS 101. CSS CODE The code in a style sheet is made up of rules of the following types

Kentico CMS, 2011 Kentico Software. Contents. Mobile Development using Kentico CMS 6 2 Exploring the Mobile Environment 1

Web Design and Development ACS Chapter 9. Page Structure

Style & Layout in the web: CSS and Bootstrap

Transcription:

By Megan Doutt

Speaking broadly, responsive web design is about starting from a reference resolution, and using media queries to adapt it to other contexts. - Ethan Marcotte (creator of the term Responsive Web Design) Responsive web design is the approach that suggests that design and development should respond to the user s behavior and environment based on screen size, platform and orientation. - Kayla Knight

Flexible Layouts ems and percentages are the ground work for a flexible layout. You can use percentages for both page elements and text. Ems are used for text,

Instead of establishing the size of your page elements with pixels, you should use percentages when working with RWD. This is the best way to build a flexible grid which is crucial for responsive web design. Ethan Marcotte has a very handy formula for figuring out proportional sizes based on an image Target / context = result Example: Say you want a font size of 24px, and you use a restyle CSS sheet that sets the default font size to 16px. You would simply divide 24 by 16 and get the resulting value in a flexible percentage. 24 (target) / 16 (context) = 1.5 (result) If the result in your equation is a really long decimal, don t round up or down. That number perfectly represents your desired text size.

The target / context = result formula also works for page layout. But it s a little trickier. Example: It is easy to apply the target/ context = result formula to widths of elements. Starting from a mock up image. In your mock up the body element to 600px. And you have a column that is 500px wide. To find the percentage you just take your target (500px) and divide it by your context (600px) which gives you a result of.83333333 or 83.33%. Where it gets tricky The context is determined by the parent of your element. So say inside your column there is another column that is 200px wide. Then your formula would be 200 (target) / 500 (size of containing element) which would equal.4 or 40%

The context is different for margins and padding so remember. When setting flexible margins, the context is the width of the element s container. When setting flexible padding, the context is the width of the element itself. Example margins: In your mock up there is a margin of 24 px on an <article> tag contained in div class= container with a width of 400px. Your formula would be 24/400=.06. Which would be placed in our CSS as 6%. Example padding: In your <article> tag you want 24px of padding. You would need the width of your <article> tag. Say it s 200px. Then your formula would be 24/200= 12% If the width of your tag is not defined it inherits the width of it s containing element.

Ems and percentages work basically the same way when used for fonts. 1 em = 100% What Is an em? An em is a unit of measurement brought to web design from graphic design. 1 em is equal to what ever the default text size is for your web site. If not set, the em uses the browser default which is usually 16 px. So if you set the text to 2ems in your CSS without setting the base text size, your text would be 32 px.

Where it gets tricky Font size is an inherited property Example: Say you set the base font size of your web page to 16px. In your page you have a div tag that has the font size set to 24px. All of the tags inside your div tag would inherit that text size as their base size. Inside your div tag is a <p> tag that you want to be the default (16px) text size. Because of inheritance your <p> tag would also be 24px. To change that your formula would look like this. 16(target) / 24(context) =.66666667 But any tags inside the <p> tag would inherit the base size set in the <p> tag. So if you had a <strong> tag that s size was set to.5em it would be really be 8px tall because the base size of 16px is inherited from the <p> tag and then multiplied by.5 For more information on font sizing read pages 157-161 in CSS the missing manual

Images are somewhat difficult to incorporate into a responsive site with out a little work. Max-width property A very handy CSS property is the max-width property. You set a percentage based on the containing element and the browser automatically resizes when the screen size changes. Works on img, embed, object, and video tags. Problems No support in Internet Explorer 6 and below You can include a separate IE6 specific style sheet where max-width: 100% property is replaced with the width: 100% A word of caution, you shouldn t rely on your browser to scale up images or video. The quality is almost always very bad.

More Problems with Windows based browsers Adds artifacts to images when scaled up Only effects IE7 and lower. There is a work around called AlphaImageLoader. Ethan Marcotte has created some JavaScript to automate the AlphaImageLoader process. You can download it at http://bkaprt.com/rwd/16/ You can also set the overflow of an image to hidden in the CSS. This however will clip the image and can degrade the meaning of your page.

You can also ask JavaScript to resize your images for you. Filament Group s Responsive Images The Filament Group has put together a tutorial that not only makes images responsive, it also reduces the resolution based on the device viewing the page. It is written so only the files that are right for the device are downloaded. This link takes you to the latest version. https://github.com/scottjehl/picturefill

Apple Automatic Resizing Stop it with this code placed in the <head> section (directly above your <title> is a good place) <meta name= viewport content= width=device-width, initial-scale=1, maximum-scale=1 This will stop devices from resizing your page automatically. CSS Working Group also added a @viewport rule to CSS that works the same as the meta tag, but you place it in your style sheet. @viewport { width: device-width; initial-scale: 1; maximum-scale: 1; }

Media queries allow us to target certain device classes and detect the physical characteristics of the device being used. Parts 1. A media type. The available types are: all braille, embossed handheld print projection screen speech tty tv

2. And the actual query enclosed inside parentheses using a media feature to inspect, followed by the target value. Available media features are: color color-index min-aspect-ratio max-aspect-ratio device-aspect-ratio device-height min-device-height max-device-height min-device-length max-device-length grid height min-height max-height monochrome min-monochrome max-monochrome orientation min-resolution max-resolution scan min-width max-width There are also some browser specific queries. Media type Target value <link rel= stylesheet media= screen (max-width: 800px) href= newcss.css /> Media feature

You can place them in your html in the link attribute or in your CSS file with the @import directive or embed the media query with the @media directive If you wanted to put the media query in your link it would look like this <link rel= stylesheet type= text/css media= screen href= newcss.css /> If you wanted to link another stylesheet in your CSS it would look like this @import url(css/newcss.css) screen (min-width: 481px) If you wanted to embed the media query in your CSS it would look like this @media screen and (min-width: 481px) { /* Your different CSS would go here */ }

You can use media quires to change your design as you encounter breaking points at different screen sizes. These are just a few. To hide unimportant content for handheld devices To adjust columns To use flexible widths To tighten up white space To adjust font sizes To change navigation menus To change background images For more detail read pages 457-459 in CSS: The Missing Manuel

While most modern browsers support media queries, there are still many in use today that do not. Browsers that Support Media Queries: Opera version 9.5 and newer Firefox version 3.5 and newer Safari 3+ Chrome Internet Explorer 9 WebKit-based Mobile Safari HP s webos Android s browser But widespread doesn t mean universal

There are a number of JavaScript based work arounds for older browsers. The Two most recommended are css-mediaqueries.js and respond.js css-mediaqueries.js Hasn t had a ton of active development Feature rich lots of code and slower download time respond.js Simply patches support for min-width and max-width queries. Does need a slight hack to work. You have to put /*/mediaquery*/ at the end of your media query. respond.js simply looks for this comment and is able to grab it faster, which means faster loading times.

According to many designers it is best to start thinking of your site with mobile first in mind. This way your most important content is established and ease of access to it is much larger. It is also a handy work around if you are trying to reach audiences who don t support media queries and don t have JavaScript. You can think desktop first if you are sure that s your audience, but try and be direct about the point of your website. If you design mobile first, you create agreement on what matters most. You can then apply the same rational to the desktop/laptop version of the web site. We agreed that this was the most important set of features and content for our customers and business- why should that change with more screen space? -Luke Wroblewski

It is important to remember your HTML source order when working with responsive web design. To ensure your most important content comes first (I believe thinking mobile first helps with this) Remember when using percentage based widths that adding borders and padding actually increase the size of your page elements. To have the padding and border be included in your set size you need to reset the box model with this code in your CSS. * { -moz-box-sizing: border-box; box-sizing: border-box; }

Responsive Web Design is a tool for designers to use It is hard, but it wouldn t be design if it were easy Know your audience! This is critical! If you are using JavaScript to create fluid images, remember that not all users have JavaScript on their devices. I think it s wise to think mobile first to avoid problems with users who don t support media queries and JavaScript. Remember font-size is an inherited property.

As designers shift to a responsive way of thinking, so will the web. I think this is a very exciting time to learn about responsive web design, and it will become more exciting in the years to come.

http://alistapart.com/article/responsive-web-design http://coding.smashingmagazine.com/2011/01/12/guidelines -for-responsive-web-design/ https://github.com/scottjehl/picturefill http://www.pixel77.com/15-mustread-responsive-web-designtutorials/ https://developer.mozilla.org/en- US/docs/Web/Guide/CSS/Media_queries CSS3: The Missing Manuel by David Sawyer McFarland Responsive Web Design by Ethan Marcotte