Responsive websites, what, when, where. Designing websites for devices

June 7, 2012 | CSS, HTML5, Web Design

Advertisement responsive-web-design

Responsiveness as the term defines deals with responding to changes and that is what it also means on the web. Responsive websites are those that respond to different devices and adapt themselves according to the devices. Since not all devices are same and also do not have same resolutions, it is better if we make a website that adjusts itself accordingly. But creating a responsive website is not as easy as creating a regular website though it is not too tough as well. There are a set of things that need to be taken care of while creating a responsive website and we will discuss those here.

Media Queries

A media query is a logical expression that is either true or false. A media query is true if the media type of the media query matches the media type of the device where the user agent is running (as defined in the “Applies to” line), and all expressions in the media query are true. Several media queries can be combined in a media query list. A comma-separated list of media queries. If one or more of the media queries in the comma-separated list are true, the whole list is true, and otherwise false. In the media queries syntax, the comma expresses a logical OR, while the ‘and’ keyword expresses a logical AND.

Example:

This media query expresses that the style sheet is usable on devices with viewport (the part of the screen/paper where the document is rendered) widths between 400 and 700 pixels:

@media screen and (min-width: 400px) and (max-width: 700px) { … }

Flexible Images

One major problem that needs to be solved with responsive Web design is working with images. The most popular option, noted in Ethan Marcotte’s article on fluid images but first experimented with by Richard Rutter, is to use CSS’s max-width for an easy fix.

img { max-width: 100%; }

As long as no other width-based image styles override this rule, every image will load in its original size, unless the viewing area becomes narrower than the image’s original width. The maximum width of the image is set to 100% of the screen or browser width, so when that 100% becomes narrower, the image adjusts itself to the new width.

CSS or JavaScript?

You can either use JavaScript to create a adaptive or responsive design or you can use what CSS has to offer. But in some cases you will  have to settle for more than just one.  Some Javascript plugins that help in making your site responsive are “Response.js” and “Responsly

Examples and Tutorials

A great tutorial can be found at “A List Apart“. It contains a tutorial to creating adaptive web design. Also you can download and check this cool responsive theme for WordPress. A detailed article about Responsive design can be found at Smashing Magazine

 

*Image credit: <a href="http://www.artistechnewmedia.com/thenest/2012/responsive-web-design/">http://www.artistechnewmedia.com/thenest/2012/responsive-web-design/</a>
Author Information
Utsav Singh Rathour
Utsav Singh Rathour is a blogger and developer for over 5 years and believes in building applications that not only tackles the problem but gives users a better interface. He is founder of Code Pixelz Media and blogs mainly at this place. Follow him at @rathour

One Response to “Responsive websites, what, when, where. Designing websites for devices”

  1. Lisa Johnson
    September 5, 2014 at 10:05 am

    Nice post!! This post is very helpful for me.

Leave a Reply



Avada WordPress Theme, Theme Fusion, Highest selling theme on themeforest.net, themeforest highest seller

  • Like us on Facebook

  • Tags

  • css.php
    WordPress SEO fine-tune by Meta SEO Pack from Poradnik Webmastera