Skip to content

Commit 8280883

Browse files
committed
Fix spacing in TOC; Change pre blocks to scroll w/ scroll shadows
The lists in a TOC have too much spacing after adding the lobotomized owl. Shrink it for desktop. The pre example code was getting wrapped and it was confusing. Some single lines looked like two etc. So change pre's to overflow with a scroll bar. To make the scroll section obvious (since scrollbars won't always be shown on mobile), add scroll shadows in direction of scrollability. I made arc shaped shadows rather than straight shadows as they look better.
1 parent 8d2b16c commit 8280883

File tree

2 files changed

+74
-2
lines changed

2 files changed

+74
-2
lines changed

doc/_static/style.css

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141

4242
* + * { margin-block-start: 1.2em;}
4343

44+
/* shrink spacing between list elements in tables of contents */
45+
div.contents * + * { margin-block-start: 0.25em;}
46+
4447
h1, h2, h3, h4, h5, h6 {
4548
line-height: 1.25;
4649
/* Larger spacing before header and smaller after to make
@@ -329,7 +332,40 @@ dd p.first { margin-block-start: 0; }
329332
#main:focus-visible {outline: none;}
330333

331334
/* Prevent examples from extending outside the viewport */
332-
div.highlight > pre {
335+
/*div.highlight > pre {
333336
overflow-wrap: anywhere;
334337
white-space: break-spaces;
338+
}*/
339+
340+
/* Forcing wrap in a pre leads to some confusing line breaks.
341+
Use a horizontal scroll. Indicate the scroll by using
342+
rounded scroll shadows.
343+
344+
https://css-tricks.com/books/greatest-css-tricks/scroll-shadows/
345+
https://blogit.create.pt/pedrolopes/2022/03/24/css-scroll-shadows/
346+
*/
347+
div.highlight > pre {
348+
overflow-wrap: none;
349+
overflow-x: auto;
350+
/* Shadows */
351+
background-image:
352+
/* Shadow covers */
353+
linear-gradient(to right, white, white),
354+
linear-gradient(to right, white, white),
355+
/* Shadow */
356+
radial-gradient(farthest-side at 0px 50%,
357+
rgba(0, 0, 20, 0.5), rgba(255, 255, 255, 0)),
358+
radial-gradient(farthest-side at 100% 50%,
359+
rgba(0, 0, 20, 0.5), rgba(255, 255, 255, 0));
360+
/* square shadows */
361+
/*
362+
linear-gradient(to right, rgba(0, 0, 0, 0.25), rgba(255, 255, 255, 0)),
363+
linear-gradient(to left, rgba(0, 0, 0, 0.25), rgba(255, 255, 255, 0));
364+
*/
365+
background-position: left center, right center,
366+
left center, right center;
367+
background-repeat: no-repeat;
368+
background-color: white;
369+
background-size: 20px 100%, 20px 100%, 16px 100%, 16px 100%;
370+
background-attachment: local, local, scroll, scroll;
335371
}

website/www/_static/style.css

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141

4242
* + * { margin-block-start: 1.2em;}
4343

44+
/* shrink spacing between list elements in tables of contents */
45+
div.contents * + * { margin-block-start: 0.25em;}
46+
4447
h1, h2, h3, h4, h5, h6 {
4548
line-height: 1.25;
4649
/* Larger spacing before header and smaller after to make
@@ -329,9 +332,42 @@ dd p.first { margin-block-start: 0; }
329332
#main:focus-visible {outline: none;}
330333

331334
/* Prevent examples from extending outside the viewport */
332-
div.highlight > pre {
335+
/*div.highlight > pre {
333336
overflow-wrap: anywhere;
334337
white-space: break-spaces;
338+
}*/
339+
340+
/* Forcing wrap in a pre leads to some confusing line breaks.
341+
Use a horizontal scroll. Indicate the scroll by using
342+
rounded scroll shadows.
343+
344+
https://css-tricks.com/books/greatest-css-tricks/scroll-shadows/
345+
https://blogit.create.pt/pedrolopes/2022/03/24/css-scroll-shadows/
346+
*/
347+
div.highlight > pre {
348+
overflow-wrap: none;
349+
overflow-x: auto;
350+
/* Shadows */
351+
background-image:
352+
/* Shadow covers */
353+
linear-gradient(to right, white, white),
354+
linear-gradient(to right, white, white),
355+
/* Shadow */
356+
radial-gradient(farthest-side at 0px 50%,
357+
rgba(0, 0, 20, 0.5), rgba(255, 255, 255, 0)),
358+
radial-gradient(farthest-side at 100% 50%,
359+
rgba(0, 0, 20, 0.5), rgba(255, 255, 255, 0));
360+
/* square shadows */
361+
/*
362+
linear-gradient(to right, rgba(0, 0, 0, 0.25), rgba(255, 255, 255, 0)),
363+
linear-gradient(to left, rgba(0, 0, 0, 0.25), rgba(255, 255, 255, 0));
364+
*/
365+
background-position: left center, right center,
366+
left center, right center;
367+
background-repeat: no-repeat;
368+
background-color: white;
369+
background-size: 20px 100%, 20px 100%, 16px 100%, 16px 100%;
370+
background-attachment: local, local, scroll, scroll;
335371
}
336372

337373
/* website only */

0 commit comments

Comments
 (0)