Wednesday, April 20, 2011

Responsive Web Design

I wanted to go over Responsive Web Design using CSS.

In the old days of web development, we had to code to common screen sizes (i.e. 800 X 600, 1024 X 768) and we patiently waited for people to upgrade their computers to have a decent amount of screen real estate so we could design things the way we really wanted. We also took on semi stretchy web layouts etc to expand and contract appropriately.

Then about 2 or 3 years ago, Apple released this little device called an iPhone with a 320 X 480 resolution which took the world by storm and suddenly a lot of people were viewing your website on a tiny screen again...

Anyways, as it can be difficult to design a site which looks good on 320 X 480 AND 1680 X 1050, we need to come up with some kind of solution.

One way is to sniff the client and then use an appropriate stylesheet, but then you are mixing CSS with either JavaScript or server side programming and also potentially maintaining a list of appropriate clients and stylesheets. Also, you can miss out new devices/clients as they come along.

The other way is to use the media queries and detect the screen size using CSS.

i.e.

@media screen and (max-device-width: 480px), screen and (max-width: 480px) {
...
appropriate iPhone/Android CSS rules go here
...
}

You can also "detect" for iPad by using 768 instead of 480.

Things to look out for
I found that although it is possible to move elements around using CSS, there are some limitations with regards to content flow. In one design that I was given by my designer, the logo was to move from the middle to the top of the page depending on the device. What I ended up doing was creating 2 logos and hid/showed them appropriately.

It also helps to break the page down to standard elements (main content, header, footer, etc...) and focus on designing/laying out these elements appropriately. Once you are done with that, you are 80% of the way there and you might only need to do some minor tweaking of the main content section thereafter (i.e. moving form labels from the side to the top for example).

It is important to know your audience as well. In my case, this time around, I am working on a site which is an adjunct to a phone app and it is important for our audience to be able to view the site well on a phone as well as a full size computer. This does involve extra work so there may not be any business to justify it in your case.

Further links
http://www.alistapart.com/articles/responsive-web-design/
http://mediaqueri.es/

14 comments:

Thom Lanch said...

Learned something from your article. Many thanks.
web design perth

Amarant said...

Web design really has to be responsive now because expectations have increased. Internet users get bored easily by static web pages.

seo consultant

web design melbourne said...

You could also make use of mobile websites to better cater to the solid smartphone market.

magi said...

Excellent and informative blog. Thanks for posting this. It’s informative and enlightening. Keep up the good work. Website Design Melbourne

web design calgary said...

"It is important to know your audience as well."- Right. Whether it be knowing what platform your target audience use, or what age group or interests they have, it pays to know.

white label seo said...
This comment has been removed by a blog administrator.
seo services said...

Just a quick question if you want to have a responsive web design, then do you need to have a fluid layout?

los angeles web design said...

The use of HTML5 in your website is also a good idea.

web design cleveland said...

Web designing can be very difficult if you don't have the basics and the fundamentals. Therefore you need to take one step at a time if you really wanted to be a web designer.

seo packages said...
This comment has been removed by a blog administrator.
Alexis Preatori said...
This comment has been removed by a blog administrator.
Marco Phillipstein said...

It is really hard to design a website that looks good on 320 X 480 AND 1680 X 1050O. Using the right spreadsheet, CSS, and Javascript can definitely help you achieve that.

web design norwich

web design perth said...

I agree with the last comment. It is indeed very difficult to create a web design for a small screen size like apple iPhoen. It's good to know that some of the blog hosts have widgets that enable website to adapt into mobile version.

SEO Services India said...
This comment has been removed by a blog administrator.