Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Responsive Design

Als Reaktion auf die Probleme mit dem getrennten Ansatz zur Entwicklung von Web-Sites für mobile und Desktop, wird eine relativ neue Idee (was ist eigentlich ziemlich alt) immer beliebter: Graben User-Agent-Erkennung, und stattdessen reagieren die Seiten  auf der Client-Seite in den Browser-Funktionen. Dieser Ansatz, der von Ethan Marcotte in seinem Artikel für A List Apart kam, wird als Responsive Web Design bekannt sein. Wie der getrennten Plattform Ansatz hat ansprechende Webdesign positive und negative Aspekte.

The Advantages

Though it wasn’t initially proposed as method for creating mobile sites, responsive design has recently gained a lot of attention as a way of taking some first steps towards mobile-friendliness in lieu of a separate mobile site.

  1. It save time and money as there isn't a need to maintain separate websites for different devices.
  2. Responsive Design provides every page with a single and unique URL.
  3. Social sharing stats (Facebook Likes, Tweets, +1 on Google plus) are not split, since the mobile and desktop versions of your web pages use a single and unique URL.
  4. Responsive Design doesn't care about user agents.

There are some really nice aspects to this approach. Since it does not rely on user-agent detection, it is more resilient and future-proof than the separate sites approach. For simple sites, it can also be significantly easier to implement and maintain than other options.

The Negatives

This approach isn’t without its limitations. Because content must be altered on the client-side with JavaScript, only minimal content changes are encouraged. In general, things can get very hairy very quickly if you are trying to code two separate sets of JavaScript to work with the same DOM. This is a big reason why web applications tend not to adopt this approach.

Giving your existing site a responsive design also involves a rewrite of your styles if the you are not sporting a flexible layout already. This could be a blessing in disguise, though; making your site’s layout responsive could be a good opportunity to modernize and clean up your site’s CSS.

Finally, since you are adding code to your scripts and styles, performance may be worse than the Separate Sites approach. There is not really any way around this, though a thoughtful refactoring of your scripts and styles might actually save a few bytes in the long run.

When it is right to choose this option

teixido_responsive-300x177.pngAs mentioned above, because content changes can be difficult, when you take this approach, you are not able to give users a strikingly different experience on mobile without a significant increase in code complexity. That said, if the desktop and mobile versions of your site are very similar, then this approach is a great option. It is well-suited to document-centric sites whose a primary use case is consistent across devices, like product pages. You may notice that the examples below are all blogs or portfolios!

Examples

Though it is not as popular as the separate sites approach, there are more and more websites employing this technique every day. Luckily, since all the code is client-side, if you’d like to see how a site technically implements this approach, it is as simple as visiting the site and clicking “View Page Source.” Here are a few examples:

Despite being a relatively young approach, there are already some emerging best practices. For example, if you are designing a site from scratch with this option in mind, it is usually worthwhile to create a small-screen design first, so that the constraints of mobile are with you from the beginning. It’s also great to use progressive enhancement for your styles instead of hiding elements of your existing site with media queries. This way, older browsers that might not support media queries still show the proper layout. An excellent presentation on the merits of this method is available here.

Approaches to mobile Web development

See the following articles for background and other approaches to developing for mobile platforms.

See also

Original document information

Originally published on 27 May, 2011 on the Mozilla Webdev blog as "Approaches to Mobile Web Development Part 3 - Responsive Design", by Jason Grlicky.

 

Schlagwörter des Dokuments und Mitwirkende

 Mitwirkende an dieser Seite: HolgerSinn.Com
 Zuletzt aktualisiert von: HolgerSinn.Com,