Monday, 19 September 2011

What is Responsive Web Design?

Responsive web design is the concept of designing a website that scales to various screen sizes.  With the increase in web surfing from tablets and mobile devices a website needs to work at different screen dimensions and resolutions.  The choice is to either build a mobile version, or have a website that scales responsively!
click image to enlarge

Currently the main "sizes" can be categorised as:

  • 960px to 1024px (tablet landscape to standard desktop)
  • 768px to 959px (tablet portrait to desktop)
  • 480px to 767px (mobile landscape to tablet portrait)
  • Less than 480px (mobile portrait)

So how do you create a website that is fluid and scales to fit these different sizes?
The secret lies in CSS3 media queries.
Media queries allow you to serve up different CSS styles depending on the current screen size.  The great thing about this is that new devices (mobiles and tablets) will be able to use media queries, and old devices will just see the standard desktop web site.

Using media queries
Based on the above sizes we can write our CSS in the following order:
/* all styles for standard desktop here */
@media only screen and (min-width: 768px) and (max-width: 959px) {
/* styles for tablet portrait here */ }
 @media only screen and (max-width: 767px) {
/* styles for mobile portrait here */}
@media only screen and (min-width: 480px) and (max-width: 767px) {
/* styles for mobile landscape here */}

And that's all there is too it!

Hiding elements in Mobile views
What if you decide there are some elements you just don't want to show in mobile views? (like flash elements or slideshows).
We can simply use CSS to hide that element in the correct portion of the above code using:
#divname {display: none;}

Scaling images
There are a number of solutions for flexible images so that they scale for the correct device:

  1. Use the media queries above to load different sized background images into div tags based on the screen size.
  2. Use width and height attributes to scale images, but this doesn't optimise the size of the image (same image is downloaded)
  3. Use the overflow property in CSS to crop images
  4. Javascript solutions that resize your images


If you're interested in mobile web design, check out the following articles about mobile phone website development:



Share/Bookmark

9 comments:

  1. Thanks a lot for ur valuable info on responsive web design and the main thing is that using media queries is very interesting to learn and work on.
    Cheers from web design company

    ReplyDelete
  2. Very informative. thanks for the info. It helps a lot. Very useful for our Web developing site

    ReplyDelete
  3. For the best SEO services in Shropshire, please consider BeVivid. Established for more than 7 years, this SEO Shrewsbury firm has a team of SEO specialists who provide result-oriented Search Engine Optimisation services to business who wish to achieve online success.

    ReplyDelete
  4. Responsive Web Design is really a recent term that is certainly accustomed to describe the thought of a web site s layout changing in response for that user's display size and resolution.Outsourcing Companies Bangalore

    ReplyDelete
  5. I had been discussing this issue with my older sister the other day, now I will have one particular a lot more argument in my hand when it’ll arrive to confrontation the moment yet again.mobile website design

    ReplyDelete
  6. Very informative and helpful. web design in oakland Thank you for providing this information.

    ReplyDelete
  7. Boost your web site to the top results of the largest search engines. We provide organic traffic based on specific keywords that you choose. Limited offer promotion, get $25 worth or organic visits using the coupon code KiWI-25-Organics

    ReplyDelete
  8. Thanks for making me aware of the base concept on RWD and the tools which we can use for implementing. It was really informative and helpful for me to upgrade my knowledge on RWD. I appreciate...
    Web Application Development Company India

    ReplyDelete
  9. I will focus on this RWD. Thank you for sharing.

    web design philippines

    ReplyDelete