Contents ...
udn網路城邦
Building a Mobile First Responsive WordPress Theme 2
2013/05/13 13:54
瀏覽255
迴響0
推薦0
引用0

3. Style the Main Layout Blocks for Small Screens

I’ll start by adding some widths and floats for the main elements, to ensure that they stretch across the screen. I add some widths and a clear:both declaration to the relevant elements:

1
2
3
4
header, nav.main, .container, .content, .sidebar, footer {
    width: 100%;
    clear: both;
}

Next, to avoid the design looking squeezed into the small screen, I’ll add padding to some elements:

1
2
3
header, nav.main, .container, footer {
    padding: 10px;
}

Note that these are the only horizontal values I’ll be defining in pixels, and I do this because I don’t want the padding to become too big as the screen size increases.

Now the site looks less crowded and the main elements are displayed beneath each other:

05-mobile-padding-applied.png

Next I’ll tidy up the widget areas and improve the navigation.

發表迴響

會員登入