Responsive Web Design Explained

Responsive web design (RWD) is a web design approach aimed at crafting sites to provide an optimal viewing experience—easy reading and navigation with a minimum of resizing, panning, and scrolling—across a wide range of devices (from mobile phones to desktop computer monitors).[1][2][3]

A site designed with RWD[1][4] adapts the layout to the viewing environment by using fluid, proportion-based grids,[5][6] flexible images,[7][8][9] and CSS3 media queries,[3][10][11] an extension of the @media rule.[12]

The fluid grid concept calls for page element sizing to be in relative units like percentages, rather than absolute units like pixels or points.[6]

Flexible images are also sized in relative units, so as to prevent them from displaying outside their containing element.[7]

Media queries allow the page to use different CSS style rules based on characteristics of the device the site is being displayed on, most commonly the width of the browser.

Mobile first, unobtrusive JavaScript, and progressive enhancement[edit]

"Mobile first", unobtrusive JavaScript, and progressive enhancement (strategies for when a new site design is being considered) are related concepts that predated RWD: browsers of basic mobile phones do not understand JavaScript or media queries, so the recommended practice is to create a basic web site, and enhance it for smart phones and PCs—rather than try graceful degradation to make a complex, image-heavy site work on the most basic mobile phones.[13][14][15][16]

Progressive enhancement based on browser-, device-, or feature-detection[edit]

Where a web site must support basic mobile devices that lack JavaScript, browser ("user agent") detection (also called "browser sniffing"), and mobile device detection[14][17] are two ways of deducing if certain HTML and CSS features are supported (as a basis for progressive enhancement)—however, these methods are not completely reliable unless used in conjunction with a device capabilities database.

For more capable mobile phones and PCs, JavaScript frameworks like Modernizr, jQuery, and jQuery Mobile that can directly test browser support for HTML/CSS features (or identify the device or user agent) are popular. Polyfills can be used to add support for features—e.g. to support media queries (required for RWD), and enhance HTML5 support, on Internet Explorer. Feature detection also might not be completely reliable: some may report that a feature is available, when it is either missing or so poorly implemented that it is effectively nonfunctional.[18][19]

Challenges, and other approaches

Luke Wroblewski has summarized some of the RWD and mobile design challenges, and created a catalog of multi-device layout patterns.[20][21][22] He suggests that, compared with a simple RWD approach, device experience or RESS (responsive web design with server-side components) approaches can provide a user experience that is better optimized for mobile devices.[23][24][25] Server-side "dynamic CSS" implementation of stylesheet languages like Sass or Incentivated's MML can be part of such an approach by accessing a server based API which handles the device (typically mobile handset) differences in conjunction with a device capabilities database in order to improve usability.[26] RESS is more expensive to develop, requiring more than just client-side logic, and so tends to be reserved for organizations with larger budgets. Google recommends responsive design for smartphone websites over other approaches.[27]

Although many publishers are starting to implement responsive designs, one ongoing challenge for RWD is that some banner advertisements and videos are not fluid.[28] However, search advertising and (banner) display advertising support specific device platform targeting and different advertisement size formats for desktop, smartphone, and basic mobile devices. Different landing page URLs can be used for different platforms,[29] or Ajax can be used to display different advertisement variants on a page.[17][21][30]

An alternative[31] to RWD is the method of Adaptive Web Delivery or AWD that is adopted by consumer brands worldwide.[citation needed] Although it is very similar to Responsive Web Design, with adaptive delivery the most significant difference is that the server hosting the website detects the devices making requests to it, and uses this information to deliver different batches of HTML and CSS code based on the characteristics of the device that have been detected.[32]

There are now many ways of validating and testing RWD designs,[33] ranging from mobile site validators and mobile emulators[34] to simultaneous testing tools like Adobe Edge Inspect.[35] The Firefox browser and the Chrome console offer responsive design viewport resizing tools, as do third parties.[36][37]

History

The technique of adapting a site's layout to a device's display was first written about by Cameron Adams in 2004.[38] Ethan Marcotte coined the term responsive web design (RWD) in a May 2010 article in A List Apart.[1] He described the theory and practice of responsive web design in his brief 2011 book titled Responsive Web Design. Responsive design was listed as #2 in Top Web Design Trends for 2012 by .net magazine[39] after progressive enhancement at #1.

Ethan Marcotte looking thoughtful
Ethan Marcotte, the unassuming father of responsive web design.

Mashable called 2013 the Year of Responsive Web Design.[40] Many other sources have recommended responsive design as a cost-effective alternative to mobile applications.

Forbes featured a piece, 'Why You Need To Prioritize Responsive Design Now' [41] where the importance was made clear that having a mobile version of your website isn’t enough anymore. Jody Resnick, President of Trighton Interactive stated in his interview with Forbes, “Responsive websites simplify internet marketing and SEO. Instead of having to develop and manage content for multiple websites, businesses with responsive sites can take a unified approach to content management because they have only the one responsive site to manage.

Resnick predicts, “As the internet transforms further into a platform of services and user interfaces that tie those services together, leveraging this technology in the future will allow companies to integrate a plethora of back-end services, such as Facebook, Twitter, Salesforce.com, and Amazon Web Services, and then present the integrated data back out the front-end iad layer on a responsive design so the application looks great on all devices without custom coding needed for each device or screen size."

Some believe that responsive design will be more prevalent than native apps simply because of the browser compatibility and the cost associated with programming the apps.

By

January 14, 2014

Media queries

From Wikipedia, the free encyclopedia

Media Queries is a CSS3 module allowing content rendering to adapt to conditions such as screen resolution (e.g. smartphone screen vs. computer screen). It became a W3C recommended standard in June 2012.[1] and is a cornerstone technology of Responsive web design.

History of Media queries

Media queries were first sketched in Håkon Wium Lie's initial CSS proposal in 1994,[2] but they did not become part of CSS1. The HTML4 Recommendation from 1997 shows an example of how Media Queries could be added in the future.[3] In 2000, W3C started work on Media Queries and also on another scheme for supporting various devices: CC/PP. The two address the same problem, but CC/PP is server-centric, while Media Queries are browser-centric.[4] The first public working draft for Media Queries was published in 2001,[5] and the specification became a W3C Recommendation in 2012 after browsers added support.

Using media queries

A media query consists of a media type and one or more expressions, involving media features, which resolve to either true or false. The result of the query is true if the media type specified in the media query matches the type of device the document is being displayed on and all expressions in the media query are true. When a media query is true, the corresponding style sheet or style rules are applied, following the normal cascading rules.[6][7]

Here is a simple example:

@media screen and (min-width:500px) { ... }

Media Types

A media type can be declared in the head of an HTML document using the "media" attribute inside of a <link> element. The value of the "media" attribute specifies on what device the linked document will be displayed.[8] Media types can also be declared within XML processing instructions, the @import at-rule, and the @media at-rule. CSS2 defines the following as media types:[9]

  • braille
  • embossed
  • handheld
  • print
  • projection
  • screen
  • speech
  • tty
  • tv

The media type "all" can also be used to indicate that a style sheet applies to all media types.[10]

By

January 14, 2014