Skip to content
This repository was archived by the owner on Apr 17, 2018. It is now read-only.

Commit 5de4259

Browse files
committed
Make the page responsive down to 780px by switching to a table layout. Further scaling is possible if we want to remove elements from the header.
1 parent 791c76a commit 5de4259

File tree

5 files changed

+38
-15
lines changed

5 files changed

+38
-15
lines changed

r2/r2/public/static/discussion.css

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,8 @@
6363
#header.discussion {
6464
background: url(/static/background-discussion.jpg) no-repeat top left;
6565
}
66-
67-
#header.discussion #header-img {
68-
height: 55px;
66+
@media (max-width: 975px) {
67+
img#tagline {
68+
display: none !important;
69+
}
6970
}
70-
71-
#header.discussion #tagline {
72-
display: none;
73-
}

r2/r2/public/static/lesswrong.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#content.clear.fullwidth {
22
padding: 0 15px;
3-
width: 920px;
3+
max-width: 920px;
44
}
55

66
div.comment-meta span span {
-3.18 KB
Loading

r2/r2/public/static/main.css

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ body {
3030
background-color: #d8d8d8;
3131
margin: 0;
3232
padding: 0;
33+
word-wrap: break-word;
34+
overflow-wrap: break-word;
3335
}
3436
#wrapper {
3537
background-color: #fff;
@@ -38,19 +40,29 @@ body {
3840
box-shadow: 0px 0px 10px #555;
3941
margin: 0 auto;
4042
padding: 0;
41-
width: 990px;
43+
max-width: 990px;
44+
min-width: 780px;
4245
}
4346
#main {
44-
padding: 15px 20px;
47+
display: table;
48+
table-layout: fixed;
49+
width: 100%;
50+
4551
}
4652
#content {
47-
float: left;
48-
padding: 0 0 0 15px;
49-
width: 695px;
53+
width: 100%;
54+
padding: 15px 20px 20px 35px;
5055
}
5156
#sidebar {
52-
float: right;
5357
width: 220px;
58+
padding: 15px 20px 20px 0;
59+
}
60+
#header {
61+
overflow: hidden;
62+
}
63+
#content, #sidebar {
64+
display: table-cell;
65+
vertical-align: top;
5466
}
5567

5668

@@ -200,7 +212,9 @@ input, select, textarea, button {
200212
a#logo {
201213
display: block;
202214
float: left;
203-
margin: 35px 10px 0 35px;
215+
height: 54px;
216+
overflow: hidden;
217+
margin: 35px 10px 14px 35px;
204218
}
205219
img#tagline {
206220
display: block;

r2/r2/templates/base.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@
3737
<meta name="description" content="${description | h}" />
3838
%endif
3939
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
40+
<meta id="viewport" name="viewport" content="width=device-width, initial-scale=1.0" />
41+
<script>
42+
/* Set initial screen size for screens smaller than our max width.
43+
* This is necessary because the viewport tag stupidly forces a zoom
44+
* and has no way to set the minimum width.
45+
* Note: This doesn't work on Firefox Mobile :(
46+
*/
47+
if (screen.width < 780) {
48+
var viewport = document.getElementById("viewport");
49+
viewport.setAttribute("content", "width=780");
50+
}
51+
</script>
4052
${self.robots()}
4153
##these are globals, so they should be run first
4254
##things that need are referenced by the reddit, the buttons, and

0 commit comments

Comments
 (0)