]> sipb.mit.edu Git - ikiwiki.git/commitdiff
Make the layout adjust to narrow viewports better
authorSimon McVittie <smcv@debian.org>
Tue, 25 Nov 2014 23:42:16 +0000 (23:42 +0000)
committerSimon McVittie <smcv@debian.org>
Mon, 1 Dec 2014 21:29:46 +0000 (21:29 +0000)
Below about 600px (phones and small windowed browsers) the sidebar
starts breaking the layout. Moving it inline helps a lot; with
modern CSS (flex layout) we can also shuffle it after the main content.
Older browsers that don't do one of the 4 variants of flex layout
will just display it above the main content, which is annoying
but not too bad.

blueview also has a minimum width set so that it won't become
ridiculously small with small fonts, but that means it gets
scrollbars below about 850px; stop enforcing the minimum width
if necessary.

Finally, blueview's relatively generous margins look good in a
desktop browser, but are just too space-hungry on a phone.
Turn them off below 600px.

doc/style.css
themes/blueview/style.css

index 4c48e5c7b9ebbcb2b9b1d6a9f49915c727f2b55c..18bf531a6150208809cee6383b9e2194ef90ce8e 100644 (file)
@@ -548,3 +548,34 @@ a.openid_large_btn:focus {
 .trailsep {
        display: none;
 }
+
+/* mobile/small-screen-friendly layout */
+@media (max-width: 600px) {
+       .sidebar {
+               width: auto;
+               float: none;
+               margin-top: 0;
+       }
+
+       /* if the mobile browser is new enough, use flex layout to shuffle
+        * the sidebar to the end */
+       .page {
+               display: -webkit-box;
+               display: -ms-flexbox;
+               display: -webkit-flex;
+               display: flex;
+               flex-direction: column;
+       }
+       #pageheader {
+               -webkit-box-ordinal-group: -1;
+               -ms-flex-order: -1;
+               -webkit-order: -1;
+               order: -1;
+       }
+       .sidebar, #footer {
+               -webkit-box-ordinal-group: 1;
+               -ms-flex-order: 1;
+               -webkit-order: 1;
+               order: 1;
+       }
+}
index af1434574b537259e4bbf77fee8780788fe18856..7b3382c357825f8eb514da00ef8cc36f4bfb2042 100644 (file)
@@ -279,3 +279,26 @@ body {
 
 }
 
+/* lose the border on mobile */
+@media (max-width: 600px) {
+       body {
+               padding: 0;
+       }
+       .page {
+               border: none;
+               margin: 0;
+       }
+       #pagebody {
+               margin: auto;
+               border: none;
+       }
+}
+
+/* cancel the minimum width if it would mean scrollbars */
+@media (max-width: 850px) {
+       .page {
+               width: auto;
+               min-width: 0;
+               padding: 0;
+       }
+}