Skip to main content

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.


@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


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
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
"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?
The use of HTML5 in your website is also a good idea.
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.
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
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.
This comment has been removed by a blog administrator.

Popular posts from this blog

Freezing Gems

What is a gem and why would you want to freeze it? In Ruby, there are times when you want to access pieces of functionality that other people of written (3rd party libraries) and you normally have 2 options. You can install a plug in or install a gem. Normally the method you use is determined by which ever is made available by the author. Gems are installed on the host machine and are pretty handy when you want to run things in the command line or else across lots of projects, but their downside is that if you use a gem in a Rails project there is no automatic publishing mechanism when you deploy your site. You will need to log onto the remote host machine and install the gem manually. Plugins are specific to Rails and are similar to gems in that they are also 3rd party libraries. However they are associated with your Rails project as opposed to your machine so they will get posted to the server on a regular deploy. Freezing a gem is the process of transforming a gem into a plug in

Unit/Functional Testing RubyAMF

One of my current projects is using RubyAMF to communicate with Flash ( On the whole this is really nice because it allows you to transfer Ruby objects directly to ActionScript ones (as opposed to translating the object into XML, sending the XML and then recreating the object in ActionScript). However, Rails does not provide a built in transport mechanism for AMF, so we cannot run functional testing directly on the data call (as we could for an XML or HTML transport layer). This is a show stopper for a lot of people (Rails w/o Unit testing = a big mess of trouble when something goes wrong). We can though serve both the HTML and the AMF formats depending on the request format. This means that we can test the object instantiation logic and make sure there are no errors in the controllers (though we cannot check the actual format of the data being served). In the controller, instead of rendering AMF alone, do the following respond_to do |format|