Skip to content

Commit

Permalink
[ruby/rdoc] Improve layout CSS
Browse files Browse the repository at this point in the history
- Use the `grid` property for the page layout.
  - https://caniuse.com/css-grid
- Adjust the `<main>` margin.
- Make the sidebar responsive and resizable.
  - https://caniuse.com/css-math-functions
  - https://caniuse.com/css-resize

Note all modern browsers support the new CSS properties and functions used by this change.

ruby/rdoc@2db5097c41
  • Loading branch information
ybiquitous authored and matzbot committed May 26, 2023
1 parent 618a04d commit 54b7ce0
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions lib/rdoc/generator/template/darkfish/css/rdoc.css
Expand Up @@ -17,6 +17,14 @@ body {
background: #fafafa;
font-family: Lato, sans-serif;
font-weight: 300;

/* Layout */
display: grid;
grid-template-columns: auto 1fr;
}

body > :last-child {
grid-column: 1 / 3;
}

h1 span,
Expand Down Expand Up @@ -181,21 +189,25 @@ table tr:nth-child(even) td {
/* @group Top-Level Structure */

nav {
float: left;
width: 260px;
font-family: Helvetica, sans-serif;
font-size: 14px;
border-right: 1px solid #ccc;
position: sticky;
top: 0;
overflow: auto;

/* Layout */
width: 260px; /* fallback */
width: max(50px, 20vw);
min-width: 50px;
max-width: 80vw;
height: calc(100vh - 100px); /* reduce the footer height */
resize: horizontal;
}

main {
display: block;
margin: 0 2em 5em 260px;
padding-left: 20px;
margin: 1em;
min-width: 340px;
font-size: 16px;
}
Expand All @@ -214,7 +226,6 @@ main h6 {
}

#validator-badges {
clear: both;
margin: 1em 1em 2em;
font-size: smaller;
}
Expand Down

0 comments on commit 54b7ce0

Please sign in to comment.