1

I am working on responsive design but not getting it properly. I need to write media queries for these devices resolutions are following.

240*320,

240*480,

320*480,

480*800,

480*856

so far i have tried these media queries but its conflicting

 @media only screen and (max-width:240px) { /* cover 240px portrait */}

 @media only screen and (min-width:320px) and (orientation : landscape) {/* cover 320px landscape for 240*320 */}

 @media only screen and (min-width : 479px) and (orientation : landscape) {/* cover 480px landscape */}

 @media only screen and (min-width : 480px) and (orientation:portrait) {/* cover 480px portrait */}

2 Answers 2

1

Below is the media queries for standard devices. You can write global styles separately and device specific styles within the defined media.

/* Smartphones (portrait and landscape) ----------- */
@media only screen 
and (min-device-width : 320px) 
and (max-device-width : 480px) {
/* Styles */
}

/* Smartphones (landscape) ----------- */
@media only screen 
and (min-width : 321px) {
/* Styles */
}

/* Smartphones (portrait) ----------- */
@media only screen 
and (max-width : 320px) {
/* Styles */
}

/* iPads (portrait and landscape) ----------- */
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) {
/* Styles */
}

/* iPads (landscape) ----------- */
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : landscape) {
/* Styles */
}

/* iPads (portrait) ----------- */
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : portrait) {
/* Styles */
}

/* Desktops and laptops ----------- */
@media only screen 
and (min-width : 1224px) {
/* Styles */
}

/* Large screens ----------- */
@media only screen 
and (min-width : 1824px) {
/* Styles */
}

/* iPhone 4 ----------- */
@media
only screen and (-webkit-min-device-pixel-ratio : 1.5),
only screen and (min-device-pixel-ratio : 1.5) {
/* Styles */
}

More info here. hope it helps.

1
  • Need some more detail on how to write these? Commented Feb 27, 2014 at 12:16
0

I wrote up this little article on media queries for various ios devices. All of these answers will get you closer. It's up to you figure out the right combination that works for your project.

Not the answer you're looking for? Browse other questions tagged or ask your own question.