Why are you trying to target different device widths and orientations? Why not just make a usable site in every sort of screen size and that way you won’t have to mess with different orientations?
PS: You shouldn’t be using device-width for your queries.
Ids are unique so there is no need to try an make them double unique.
#main #sidebar,
There is only ever one #sidebar on the page so don’t make the browser go looking for irrelevant content.
‘#sidebar’ is fine.
If you do say something like ‘#main#sidebar {}’ then you must follow the same process in your media query so that you keep the same specificity and that would avoid the use of !important…
Remember simpler is better
As Ryan said don’t chase device widths or orientation but use screen width instead for more reliable results (assuming you have the correct viewport meta tag in place).
@Ryan I have been rading your article with interest. Your arguments were compelling enough
I have a short question though. For smartphones and tablets (portrait) I want the divs sidbar and content to be on top of eachother. For smartphones and tablets (landscape) I just need some ajustments in width, padding and font-size, etc Right now I have the folloing media qury to accomplish that:at least for smartphones (portrait)
Chasing devices and orientation is largely irrelevant and futile (unless you are building a specific app for a device). What you need only be interested in for normal responsive sites is how the design fits across the screen. Forget mobile widths and tablet widths and orientation because the combination of all those across all devices runs into hundreds of different permutations and you will never satisfy all of them.
Simply make your design fit at every pixel on your desktop browsers as you open and close the screen. The point where you need to make the design go into one column will be obvious and will be dictated by the design and not the device and that point of change will be relevant to all devices as you are really only interested in the width of the display; no matter the device or orientation.
It would be illogical to have mobile and tablet reverting to single columns at the same time because some tablets are very large. Forget devices and concentrate on how your design looks at different widths and create breakpoints where your design needs it and not where you think a device may be watching