`` tag.
.. code-block:: css
:project: sphinx:dirhtml
:filename: _static/css/styles.css
article {
code.literal {
&::before, &&::after {
content: "`";
}
span.pre {
font-weight: 600;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
}
}
While code blocks are in a ```` tag.
.. code-block:: css
:project: sphinx:dirhtml
:filename: _static/css/styles.css
div.highlight {
padding: 0.5em;
margin: 0.5em 0;
overflow-x: auto;
border: solid 1px var(--border-color);
border-radius: 5px;
}
I use `awdur `__ throughout this site to take the contents of code blocks and export them to separate code files (for example all the CSS on this page!).
Awdur provides a code block header, indicating where the code will be exported to.
This header also needs to be styled to match the look and feel of this site.
.. code-block:: css
:project: sphinx:dirhtml
:filename: _static/css/styles.css
div.awdur-codeblock {
border: none;
div.awdur-codeblock-header {
color: var(--fg-sidebar);
background: var(--bg-sidebar);
padding: 0 0.5em;
border: solid 1px var(--border-color);
border-top-left-radius: 5px;
border-top-right-radius: 5px;
border-bottom: none;
}
div.highlight {
border-top: none;
border-top-left-radius: 0;
border-top-right-radius: 0;
margin-top: 0;
}
}
Typography
""""""""""
.. code-block:: css
:project: sphinx:dirhtml
:filename: _static/css/styles.css
article {
section {margin-top: 2em;}
h1, h2, h3, h4, h5, h6 { color: var(--fg-accent); }
p { margin: 1em 0; }
table {
line-height: unset;
p { margin: 0;}
}
}
Post Collections
^^^^^^^^^^^^^^^^
I quite liked the idea of placing all of my blog posts on a timeline, but it does involve a fair amount of CSS.
I keep telling myself that I'm going to expand the type of "events" in the list... someday! π
.. code-block:: css
:project: sphinx:dirhtml
:filename: _static/css/styles.css
article.summary {
display: grid;
grid-template-columns: 250px auto;
& > :not(aside) {
padding: 0 1em;
}
header, footer {
grid-column: 2;
}
header {
position: relative;
&::before {
content: '';
width: 0.75em;
height: 0.75em;
background: var(--border-color);
border-radius: 100%;
position: absolute;
top: 1em;
left: -0.4em;
}
}
aside {
grid-row: 1 / span 3;
border-right: solid 1px var(--border-color);
padding: 0 1em;
section.post-metadata {
margin-top: 0.4em;
align-items: flex-start;
h5 { display: none; }
ul.taglist { gap: 0.5em; }
}
}
footer {
border-top: none;
text-align: right;
margin-bottom: 4em;
}
}
Of course on smaller displays, things need to be rearranged a bit.
.. code-block:: css
:project: sphinx:dirhtml
:filename: _static/css/styles.css
@media screen and (max-width: 1200px) {
article.summary {
grid-template-columns: auto;
header, footer { grid-column: unset; }
header::before { display: none; }
aside {
grid-row: unset;
border: none;
}
}
}
It would be interesting to see if I can replace the above with a container query at some point.
Search Results
^^^^^^^^^^^^^^
The search results page requires its own set of rules.
.. code-block:: css
:project: sphinx:dirhtml
:filename: _static/css/styles.css
section#search-results {
padding: 2em;
h2 { color: var(--fg-accent); }
p.search-summary {
padding: 1em 0;
}
ul.search {
padding: 0;
li {
margin: 1em 0;
padding: 1em;
list-style: none;
border: solid 1px var(--fg-accent-dim);
border-radius: 3px;
}
p.context {
margin: 0.5em 0;
}
}
}
Footer
------
.. code-block:: css
:project: sphinx:dirhtml
:filename: _static/css/styles.css
footer.site {
color: var(--fg-sidebar);
background: var(--bg-sidebar);
grid-column: span 3;
}