All posts by manisha

Media Width/ Device Width

Responsive Web Design Media Width Viewport Size

The Following table shows screen resolution for different devices. For more detail please visit wikipedia. It is always better to write your media query in your CSS file for the following resolutions. 320px, 480px, 600px, 800px, 960px, 1024px and 1280px+. Click here to know how to crate a css file for responsive web design.

Device Name With Resolution
Company Model Diagonal
cm/in
Resolution Viewport
Apple iPad – 1st Gen, 2 25 (9.7) 1024 x 768 768 x 1024
Apple iPad – 3rd Gen, 4th Gen 25 (9.7) 2048 x 1536 768 x 1024
Apple iPad Mini – 1st Gen 20 (7.9) 1024 x 768 768 x 1024
Apple iPhone 4 / iPod Touch 8.9 (3.5) 960 x 640 320 x 480
Apple iPhone 4S / iPod Touch 8.9 (3.5) 960 x 640 320 x 480
Apple iPhone 5 10 (4) 1136 x 640 320 x 568
Apple iMac 21.5-inch 55 (21.5) 1920 x 1080 1920 x 1080
Apple iMac 27-inch 69 (27) 2560 x 1440 2560 x 1440
Blackberry BlackBerry PlayBook 18 (7) 1024 x 600 600 x 1024
Blackberry BlackBerry Z10 11 (4.2) 1280 x 768 345 x 521
Nokia Lumia 710 9.4 (3.7) 800 x 480 320 x 480
Motorola Motorola Defy 9.4 (3.7) 854 × 480 320 x 569
Motorola Motorola Droid 9.4 (3.7) 480 x 854 360 x 599
Motorola Motorola Droid Razr 11 (4.3) 540 x 960 360 x 640
Motorola Motorola Razr HD 4G 12 (4.7) 720 x 1280 360 x 598
Motorola Motorola Milestone 9.4 (3.7) 480 x 854 320 x 569
Motorola Motorola Xoom 25.7 (10.1) 800 x 1280 800 x 1280
Nokia Lumia 800 9.4 (3.7) 800 x 480 320 x 480
Nokia Lumia 820 11 (4.3) 800 x 480 320 x 480
Nokia Lumia 900 11 (4.3) 800 x 480 320 x 480
Nokia Lumia 920 11 (4.5) 1280 x 768 320 x 480
Nokia Lumia 1020 11 (4.5) 1280 x 768  –
Samsung Galaxy W (I8150) 9.4 (3.7) 480 x 800  –
Samsung Galaxy S 10 (4.0) 480 x 800 320 x 534
Samsung Galaxy SII 10.8 (4.27) 480 x 800 320 x 533
Samsung Galaxy S III (I9300) 12 (4.8) 720 x 1280 360 x 640
Samsung Galaxy S4 (I9500) 13 (5) 1080 x 1920
Samsung Galaxy Nexus 11.8 (4.65) 720 x 1280 320 x 532
Samsung Galaxy Tab 18 (7) 600 x 1024 600 x 1024
Samsung Galaxy Tab 7.7 20 (7.7) 800 x 1280 800 x 1280
Samsung Galaxy Tab 10.1 26 (10.1) 800 x 1280 800 x 1280
Samsung Galaxy Note 13 (5.3) 800 x 1280 400 x 640
Samsung Galaxy Note II 14.1 (5.55) 720 x 1280 360 x 640
Samsung Galaxy Note 10.1 26 (10.1) 1280 x 800 800 x 1280
Sony Sony Vaio Z92 33 (13.1) 1600 x 900
Sony Sony Vaio Z128 33 (13.1) 1920 x 1080
Sony Sony Vaio F series 42 (16.4) 1920 x 1080
Sony Xperia S 11 (4.3) 720 x 1280 360 x 640
Sony Xperia Sola 9.4 (3.7) 480 x 854 320 x 569
Sony Xperia U 8.9 (3.5) 854 x 480 320 x 569
Sony Xperia Ion 11.6 (4.55) 720 x 1280
Sony Xperia Z 13 (5) 1920 x 1080 360 x 598
Sony Xperia E 8.9 (3.5) 320 x 480 320 x 480

Media Queries

How to create media queries in Responsive Web

We need to write our media query for the following resolutions in our css file.  320px,  480px,  600px,  800px,  960px, 1024px and 1280px+.  So @media will from 320px to 479px,  480px to 599px, 600px to 767px,  768px to 959px,  960px to 1023px, 1024px to 1279px and lastly the default css which display 1280px and higher resolutions.  If your design layout is below 1024px the you need not to write mediaquery for 1024px to 1279px.

For the above criteria the css file should be like this

/*
 Your default css code goes here..
*/

@media (min-width: 960px) and (max-width: 1023px) { 
  /* CSS for browsers less than 1024px*/
}

@media (min-width: 768px) and (max-width: 959px) { 
  /* CSS for browsers less than 960px*/
}
@media (min-width: 600px) and (max-width: 767px) { 
  /* CSS for browsers less than 768px*/
}

@media (min-width: 480px) and (max-width: 599px) { 
  /* CSS for browsers less than 600px*/
}

@media (min-width: 321px) and (max-width: 479px) { 
  /* CSS for browsers less than 480px*/
}

@media (max-width: 320px) { 
 /* CSS For 320px or less browsers */
}

Though there is no standing rule for device width, you can use media width for any screen resolution. The above is just a sample to show how to define @media and write css code.

Click here to view list of devise and screen resolution in pixel.

Responsive web design (RWD)

What is responsive web design?

In very simple language the website which fit in any resolution with the help of CSS is know as responsive web design. Now a days mobile and tablet users are increasing day by day, So you need to create such a web site which fit in all media. You can create responsive web page with the help of HTML5 and CSS3. Before designing your web page keep it in your mind that each and every part of your web site need to be responsive / auto resizable as the browser width changes. Photo gallery, image stroller, top menu, footer links every thing should be resizable.

How to create responsive web design?

With the help of CSS3 media queries you can create responsive web designs. CSS3 media queriesaccept AND, NOT with features like width, height, max-width, max-height, device-height, orientation, aspect-ratio, resolution etc.

There are three way to implement media queries:

1. Using @import rule
2. Writing Media Queries Directly in a Style Sheet
3. Include a query in a linked style sheet’s media attribute
Using @import rule
@import url(style600.css) screen and (min-width: 600px);
Writing Media Queries Directly in a Style Sheet
@media screen and (min-width: 600px){
  #section{
     width: 550px;
  }
}
Include a query in a linked style sheet’s media attribute
<link rel="stylesheet" type="text/css" 
media="screen and (max-device-width: 600px)" href="style600.css" />

Viewport in meta tag

Another important option in Responsive Web design is defining Viewport in meta tag. Viewport meta tag is used to control layout on mobile browsers.
<meta name="viewport" content="width=device-width, initial-scale=1, 
maximum-scale=1">

Viewport Width

Many sites set their viewport to “width=320, initial-scale=1″ to fit better in iPhone, or other device having viewport 320. Please note that the screen resolution is not always same as viewport. Click here to see screen resolution and viewport of different devices.
<meta name="viewport" content="width=320, initial-scale=1">

Viewport width and Screen width