Skip to content

Commit 7e2ef2c

Browse files
committed
rollup merge of rust-lang#21133: iKevinY/mobile-rustdoc
Just a couple of tweaks to improve the appearance of pages like [The Rust Reference](http://doc.rust-lang.org/reference.html) on mobile to advance the progress of rust-lang#20850. Changing the viewport wasn't quite good enough to make it mobile-friendly, as large tables forced the page to become wider than the screen width. Using `overflow-x`, tables that are too large become horizontally scrollable instead of forcing the *entire page* to become horizontally scrollable. Also, there was at least one case where an extremely long piece of inline code was wider than the actual width of the screen (`std::ptr::copy_nonoverlapping_memory`), so I changed `word-wrap` to allow inline code to break in the middle of words instead of only text within `pre` tags. This isn't a change included in this PR, but rather something up for discussion. Currently, code blocks that contain long lines simply wrap onto the next line. What if rather than wrapping, they were horizontally scrollable instead? I'm not sure what the general preference is regarding this. r? @steveklabnik
2 parents b1a7e34 + 5a16ceb commit 7e2ef2c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/doc/rust.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ h5 a:hover {text-decoration: none;}
195195

196196
pre, code {
197197
font-family: "Source Code Pro", Menlo, Monaco, Consolas, "DejaVu Sans Mono", monospace;
198+
word-wrap: break-word;
198199
}
199200
pre {
200201
border-left: 2px solid #eee;
@@ -204,7 +205,6 @@ pre {
204205
margin: 20px 0;
205206
font-size: 13px;
206207
word-break: break-all;
207-
word-wrap: break-word;
208208
}
209209
code {
210210
padding: 0 2px;
@@ -315,6 +315,8 @@ hr {
315315
table {
316316
border-collapse: collapse;
317317
border-spacing: 0;
318+
overflow-x: auto;
319+
display: block;
318320
}
319321

320322
table tr.odd {

0 commit comments

Comments
 (0)