Reputation: 331
I found out my Droid has a max width of 800 pixels, which I think some lower-resolution computers are smaller than, but I want my Droid to display the mobile CSS, so I am not sure max device width is the best solution. So does anybody know how I'd design my CSS link tags so that the mobile CSS is used only by smartphones while the desktop CSS is used only by desktop computers (including the kind with a width under 800px)?
Upvotes: 33
Views: 121843
Reputation: 3064
I tried the solutions above, but they didn't work for iPad in landscape mode. The iPad Landscape is 1024 px. So my solution was:
@media only screen and (min-width: 1025px) {
.myClass {
/*...your desktop-only style...*/
}
}
Upvotes: 12
Reputation: 1095
The gap between mobile and desktop devices is getting closer and closer -consider, for example, tablets or the recently new hybrid devices.
As Aaron points, you might want to define different rules based on device screen (min-width or max-width). Eg:
@media screen and (min-width: 800px) {
// this css will only be used when the screen size is min 800px
}
A different criteria you might want to use is targeting devices based on the their screen capabilities:
Upvotes: 5
Reputation: 11693
Responsive Web Design, using media-queries
@media screen and (min-width: 800px) {
// this css will only be used when the screen size is min 800px
}
Upvotes: 55