1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-23 21:02:09 +00:00

Simplify styling

Comply with the upcoming article on best practices for textual websites.
This commit is contained in:
rohan kumar 2020-11-23 15:47:27 -08:00
parent 1a9b5f4dd4
commit 712ca3737c
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
6 changed files with 106 additions and 250 deletions

View file

@ -2,6 +2,8 @@
{{ trim (readFile (replace $.File.Path ".md" ".gmi")) "\n" | safeHTML }} {{ trim (readFile (replace $.File.Path ".md" ".gmi")) "\n" | safeHTML }}
---
“{{$.Title | safeHTML}}” was published on {{.Date.Format "January 2, 2006"}}. “{{$.Title | safeHTML}}” was published on {{.Date.Format "January 2, 2006"}}.
=> / Back to the home page{{ with .OutputFormats.Get "html" }} => / Back to the home page{{ with .OutputFormats.Get "html" }}

View file

@ -1,48 +1,33 @@
{{ if not (eq .Site.Params.dark "on") -}} {{ if not (eq .Site.Params.dark "on") -}}
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
{{ end -}} {{ end -}}
body { :root {
color: #ebebeb; --dim-text: #a7a7a7;
background: #121212; --shaded-bg: #222;
} }
header#banner a { html{
color: #e0e0e0; color: white;
text-decoration: none; background: black;
} }
header#banner nav ul li a { header#banner a {
color: #cccccc; color: white;
} }
main#content a, footer a { main#content a, footer a {
color: #00b1ed; color: #00b1ed;
} }
main#content p { main#content hr {
color: #f5f5f5; border-color: #5c5c5c;
} }
main#content hr { main#content #toc h4 {
background: #5c5c5c; color: #d4d4d4;
} }
main#content #toc h4 { {{- if not (eq .Site.Params.dark "on") -}}
color: #d4d4d4;
}
main#content ul#posts small {
color: #a7a7a7;
}
main#content ul#posts li a:hover {
color: #21c7ff;
}
main#content header#post-header time {
color: #a7a7a7;
}
{{- if not (eq .Site.Params.dark "on") -}}
} }
{{- end -}} {{- end -}}

View file

@ -1,70 +1,60 @@
*, *:before, *:after { :root {
box-sizing: border-box; --dim-text: #454545;
--shaded-bg: #e3e3e3;
} }
html { html {
font-size: 62.5%; line-height: 1.5rem;
font-family: sans-serif;
} }
body { body {
font-size: 16px; max-width: 1000px;
font-size: 1.6rem; margin: 0 auto;
font-family: sans-serif; padding: 0 5rem;
color: #313a3d;
width: 100%;
margin: 0 auto;
padding: 0 16px;
line-height: 1.6;
} }
header#banner { header#banner {
margin: 25px 0; margin: 2rem 0;
} }
header#banner a { header#banner a {
color: #313a3d; color: black;
text-decoration: none; text-decoration: none;
} }
header#banner a:hover { header#banner a:hover {
text-decoration: underline; text-decoration: underline;
} }
header#banner h2 { header#banner h2 {
display: inline; display: inline;
font-size: 21px; font-size: 1.5rem;
font-size: 2.1rem;
margin: 0 8px 0 0;
} }
header#banner nav { header#banner nav {
display: inline-block; display: inline-block;
padding: 0 1rem;
} }
header#banner nav ul { header#banner nav ul {
list-style-type: none; list-style-type: none;
font-size: 1.05em; font-size: 1.25rem;
text-transform: lowercase; text-transform: lowercase;
margin: 0; margin: 0;
padding: 0; padding: 0
} }
header#banner nav ul li { header#banner nav ul li {
display: inline; display: inline;
margin: 0 3px; margin: 0 0.5rem;
} }
header#banner nav ul li a { header#banner nav ul li a {
color: #454545; color: var(--dim-text);
} }
main#content a, footer a { main#content a, footer a {
color: #007dfa; color: #007dfa;
text-decoration: none;
}
main#content a:hover {
text-decoration: underline;
} }
main#content h1, main#content h1,
@ -73,193 +63,118 @@ main#content h3,
main#content h4, main#content h4,
main#content h5, main#content h5,
main#content h6 { main#content h6 {
margin-bottom: 0; display: block;
line-height: 1.15; margin: 1.5rem 0 1rem;
}
main#content h3 {
font-size: 19px;
font-size: 1.9rem;
}
main#content h1 + p,
main#content h2 + p,
main#content h3 + p,
main#content h4 + p,
main#content h5 + p,
main#content h6 + p {
margin-top: 5px;
}
main#content p {
color: #394548;
margin: 16px 0;
}
main#content hr {
height: 1px;
border: 0;
background: #d8d8d8;
} }
/* index.html styles */ /* index.html styles */
main#content ul#posts { main#content ul#posts {
list-style-type: none; list-style-type: none;
font-size: 16px; padding: 0;
font-size: 1.6rem;
margin-top: 0;
padding: 0;
} }
main#content ul#posts li { main#content ul#posts li {
margin: 5px 0; line-height: 2rem;
padding: 0; padding: 0;
} }
main#content ul#posts small { main#content ul#posts small {
font-size: 0.8em; color: var(--dim-text);
color: #767676;
margin-left: 10px;
} }
main#content ul#posts li a { main#content ul#posts li a {
text-decoration: none; text-decoration: none;
} }
main#content ul#posts li a:hover { main#content ul#posts li a:hover {
color: #369aff; text-decoration: underline;
}
main#content ul#posts li a:hover small {
color: inherit;
} }
/* single.html styles */ /* single.html styles */
main#content header#post-header h1 { main#content h1 {
display: block; font-size: 1.5rem;
font-size: 23px; line-height: 2.5rem;
font-size: 2.3rem;
line-height: 1.15;
} }
main#content h2 {
main#content header#post-header time { font-size: 1.25rem;
display: block; }
font-size: 0.85em; main#content h3 {
color: #767676; font-size: 1.125rem;
} }
main#content #toc { main#content #toc {
border: 1px solid #b1b1b1; margin: 1rem 0;
border-radius: 1px; padding: 0.5rem 1rem;
line-height: 26px;
margin: 16px 0;
padding: 9px 14px;
}
main#content #toc h4 {
font-size: 1.06em;
color: #3d3d3d;
margin: 0;
} }
main#content #toc nav#TableOfContents { main#content #toc nav#TableOfContents {
margin-top: 4px; margin-top: 0.25rem;
}
main#content #toc nav#TableOfContents > ul, main#content #toc nav#TableOfContents > ol {
margin-left: -40px;
}
main#content #toc ul, main#content #toc ol {
font-size: 0.98em;
margin: 0;
padding: 0 0 0 40px;
} }
main#content #toc ul { main#content #toc ul {
list-style-type: none; list-style-type: none;
} }
main#content #toc ol { main#content #toc ol {
counter-reset: item; counter-reset: item;
} }
main#content #toc ol li { main#content #toc ol li {
display: block; display: block;
}
main#content #toc ol li:before {
content: counters(item, ".") ". ";
counter-increment: item;
} }
main#content img { main#content img {
max-width: 100%; max-width: 100%;
margin: 0 auto; margin: 0 auto;
} }
main#content figure { main#content figure {
margin: 16px 0; margin: 16px 0;
} }
main#content figure img { main#content figure img {
display: block; display: block;
max-width: 100%; max-width: 100%;
margin: 0 auto; margin: 0 auto;
} }
main#content figure figcaption { main#content figure figcaption {
font-size: 0.92em; font-size: 0.92em;
font-style: italic; font-style: italic;
line-height: 22px; line-height: 1.5rem;
text-align: center; text-align: center;
margin-top: 6px; padding: 0 1rem;
padding: 0 10px;
} }
main#content figure figcaption h4 { main#content figure figcaption h4 {
font-style: normal; font-style: normal;
display: inline; display: inline;
margin: 0; margin: 0;
} }
main#content figure figcaption p { main#content figure figcaption p {
display: inline; display: inline;
margin: 0; margin: 0;
padding-left: 8px; padding-left: 0.5rem;
}
main#content code,
main#content pre {
font-family: monospace;
} }
main#content code { main#content code {
font-size: 14px; font-size: 16px;
padding: 0 5px; background-color: var(--shaded-bg);
} }
main#content pre { main#content pre {
display: block; overflow-y: visible;
overflow-x: auto; overflow-x: scroll;
font-size: 14px; background-color: var(--shaded-bg);
white-space: pre; padding: 0.5rem;
margin: 20px 0;
padding: 1.5rem 1.5rem;
line-height: 1.4;
} }
main#content pre code { main#content code {
padding: 0; padding: 0.1rem 0.25rem;
}
main#content section.footnotes {
font-size: 0.9em;
} }
footer#footer { footer#footer {
font-size: 14px; color: var(--dim-text);
font-size: 1.4rem; margin: 2rem 0;
color: #949494;
margin: 40px 0;
} }

View file

@ -0,0 +1,6 @@
@media (max-width: 770px) {
body {
max-width: 600px;
padding: 0 1rem;
}
}

View file

@ -1,52 +0,0 @@
@media (min-width: 770px) {
body {
width: 600px;
line-height: 1.5;
}
main#content hr {
width: 108%;
margin-left: -3.8%;
}
/* index.html styles */
header#banner h2 {
font-size: 25px;
font-size: 2.5rem;
}
main#content h3 {
font-size: 20px;
font-size: 2rem;
}
main#content ul#posts {
font-size: 18px;
font-size: 1.8rem;
}
/* single.html styles */
main#content header#post-header h1 {
font-size: 26px;
font-size: 2.6rem;
}
main#content img {
max-width: 108%;
margin-left: -3.8%;
}
main#content figure {
margin-left: -3.8%;
}
main#content figure img {
max-width: 108%;
}
main#content pre {
width: 108%;
margin-left: -3.8%;
padding: 1.5rem 2.2rem;
}
}

View file

@ -11,7 +11,7 @@
{{ $resources = $resources | append (resources.Get "/css/main.css") -}} {{ $resources = $resources | append (resources.Get "/css/main.css") -}}
{{ $resources = $resources | append (resources.Get "/css/min770px.css") -}} {{ $resources = $resources | append (resources.Get "/css/max770px.css") -}}
{{ $dark := .Site.Params.dark | default "auto" -}} {{ $dark := .Site.Params.dark | default "auto" -}}
{{ if not (eq $dark "off") -}} {{ if not (eq $dark "off") -}}