]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
docs: improve table readability
authorBenjamin Franzke <benjaminfranzke@googlemail.com>
Sat, 21 May 2022 14:28:32 +0000 (16:28 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Sat, 21 May 2022 21:41:21 +0000 (22:41 +0100)
Let the table span more than the default content width,
if the table contains alot of data (controlled by width: auto)
(720px is very good for continuous text, but too narrow for tables).

The container class is therefore adapted to put the
width restriction on the elements itself, allowing for
exceptions for individual elements like <table> and
<h1> (which used an offset margin before and is now
streamlined to use a max-width as well).

Also add a striped background to ease reading rows
and allow for horizontal mobile scrolling without
overflowing the entire document, only the table itself.

docs/style.css

index 112e5457c86488fbae45a85f7d7ab5434dceb1d2..56ed036603ae1c808db77cc5e1afe60cfdf9b652 100644 (file)
@@ -43,6 +43,8 @@
   --sd-highlight-bg: var(--sd-highlight-bg-light);
   --sd-highlight-inline-bg: var(--sd-highlight-inline-bg-light);
   --sd-link-font-weight: var(--sd-font-weight-bold);
+  --sd-table-row-bg: var(--sd-highlight-inline-bg-light);
+  --sd-table-row-hover-bg: var(--sd-gray);
 }
 
 @media (prefers-color-scheme: dark) {
@@ -56,6 +58,8 @@
     --sd-highlight-bg: var(--sd-highlight-bg-dark);
     --sd-highlight-inline-bg: var(--sd-highlight-inline-bg-dark);
     --sd-link-font-weight: var(--sd-font-weight-normal);
+    --sd-table-row-bg: var(--sd-highlight-inline-bg-dark);
+    --sd-table-row-hover-bg: var(--sd-highlight-bg-dark);
   }
 }
 
@@ -91,8 +95,6 @@ h1 {
 }
 @media screen and (min-width: 650px) {
   h1 {
-    margin-left: 10%;
-    margin-right: 10%;
     font-size: 2.375em;
   }
 }
@@ -125,13 +127,63 @@ hr {
 }
 
 /* Layout */
-.container {
+.container > * {
   width: 80%;
   margin-left: auto;
   margin-right: auto;
   max-width: 720px;
 }
 
+.container > table {
+  max-width: 1600px;
+}
+
+.container > h1 {
+  max-width: 530px;
+}
+
+/* Tables */
+table {
+  width: auto !important;
+  border-collapse: separate;
+  border-spacing: 0;
+  margin-top: 2em;
+  margin-bottom: 3em;
+  overflow-x: auto;
+  display: block; /* required for overflow-x auto on tables */
+}
+@media screen and (min-width: 768px) {
+  table {
+    display: table;
+    border-left: 1rem solid transparent;
+    border-right: 1rem solid transparent;
+  }
+}
+
+thead tr,
+tbody:first-child tr:nth-child(odd),
+thead + tbody tr:nth-child(even) {
+  background-color: var(--sd-table-row-bg);
+}
+
+tbody tr:hover {
+  background-color: var(--sd-table-row-hover-bg) !important;
+}
+
+th, td {
+  vertical-align: top;
+  text-align: left;
+  padding: .5rem;
+}
+
+th:first-child, td:first-child {
+  padding-left: 0.75rem;
+}
+
+th:last-child, td:last-child {
+  padding-right: 0.75rem;
+}
+
 /* Custom content */
 .intro-code-block {
   background-color: var(--sd-brand-black);