From 0e0f5edbec54436ebb887e92997f42079ee38056 Mon Sep 17 00:00:00 2001 From: Jimmy Cai Date: Tue, 8 Sep 2020 12:48:34 +0200 Subject: [PATCH] feat(scss): add table style Style taken from: https://github.com/lepture/yue.css closes: https://github.com/CaiJimmy/hugo-theme-stack/issues/3 --- assets/scss/partials/layout/article.scss | 25 ++++++++++++++++++++++++ assets/scss/variables.scss | 6 ++++++ 2 files changed, 31 insertions(+) diff --git a/assets/scss/partials/layout/article.scss b/assets/scss/partials/layout/article.scss index 792ab69..801a36c 100644 --- a/assets/scss/partials/layout/article.scss +++ b/assets/scss/partials/layout/article.scss @@ -287,4 +287,29 @@ box-shadow: 0px -10px 0px rgba(var(--link-background-color), var(--link-background-opacity-hover)) inset; } } + + table { + margin: 0 var(--content-padding); + width: 100%; + max-width: calc(100% - var(--content-padding) * 2); + border-collapse: collapse; + border-spacing: 0; + margin-bottom: 1.5em; + font-size: 0.96em; + } + + th, + td { + text-align: left; + padding: 4px 8px 4px 10px; + border: 1px solid var(--table-border-color); + } + + td { + vertical-align: top; + } + + tr:nth-child(even) { + background-color: var(--tr-even-background-color); + } } diff --git a/assets/scss/variables.scss b/assets/scss/variables.scss index a02ebd6..244b5ae 100644 --- a/assets/scss/variables.scss +++ b/assets/scss/variables.scss @@ -79,6 +79,9 @@ $on-desktop-large: 1920px; --code-background-color: rgba(0, 0, 0, 0.12); --code-text-color: #808080; + + --table-border-color: #dadada; + --tr-even-background-color: #efefee; } @media (prefers-color-scheme: dark) { @@ -99,5 +102,8 @@ $on-desktop-large: 1920px; --code-background-color: #272822; --code-text-color: rgba(255, 255, 255, 0.9); + + --table-border-color: #717171; + --tr-even-background-color: #545454; } }