Media Queries
@media screen {
body { background-color: #ddd; }
}@media screen, print {
body { background-color: #ddd; }
}#body-container {
width: 950px;
margin: 0 auto;
}
#section-container {
width: 690px;
float: left;
}
#side-container {
width: 260px;
float: left;
}
/* media rule for devices for upto max width of 950px */
@media screen and (max-width:950px) {
#body-container { width: 100%; }
#section-container { width: 70%; }
#side-container { width: 30%; }
}
/* for devices having width of 640 or less, make section and side occupy whole width */
@media screen and (max-width:640px) {
#section-container { width: 100%; }
#side-container { width: 100%; }
}
/* for devices having width of less than 320px,
if width of container is made responsive to such
smaller screen size contents won't be visible properly.
So set body-container size fixed to 320px & if screen size is less,
then horizontal scroller would be enabled
to see the contents which are beyond the visible screen area */
@media screen and (max-width:320px) {
#body-container { width: 320px; }
}Last updated