mirror of
https://github.com/frainfreeze/the-monospace-web-pandoc
synced 2025-12-30 02:59:50 -08:00
fix line height and add details
This commit is contained in:
26
index.css
26
index.css
@@ -193,6 +193,26 @@ img, video {
|
|||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
details {
|
||||||
|
border: var(--border-thickness) solid var(--text-color);
|
||||||
|
padding: calc(var(--line-height) - var(--border-thickness)) 1ch;
|
||||||
|
}
|
||||||
|
|
||||||
|
summary {
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: var(--line-height);
|
||||||
|
}
|
||||||
|
|
||||||
|
details ::marker {
|
||||||
|
display: inline-block;
|
||||||
|
content: '►';
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
details :last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
white-space: pre;
|
white-space: pre;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
@@ -245,7 +265,7 @@ li {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
::marker {
|
li::marker {
|
||||||
line-height: 0;
|
line-height: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,7 +295,7 @@ input, button, textarea {
|
|||||||
input[type=checkbox] {
|
input[type=checkbox] {
|
||||||
display: inline-grid;
|
display: inline-grid;
|
||||||
place-content: center;
|
place-content: center;
|
||||||
vertical-align: middle;
|
vertical-align: top;
|
||||||
width: 2ch;
|
width: 2ch;
|
||||||
height: var(--line-height);
|
height: var(--line-height);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@@ -323,6 +343,8 @@ button:active {
|
|||||||
label {
|
label {
|
||||||
display: block;
|
display: block;
|
||||||
width: calc(round(down, 100%, 1ch));
|
width: calc(round(down, 100%, 1ch));
|
||||||
|
height: auto;
|
||||||
|
line-height: var(--line-height);
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
11
index.html
11
index.html
@@ -72,7 +72,16 @@ elements.</p>
|
|||||||
it’s just markup. This, for instance, is a regular paragraph.</p>
|
it’s just markup. This, for instance, is a regular paragraph.</p>
|
||||||
<p>Look at this horizontal break:</p>
|
<p>Look at this horizontal break:</p>
|
||||||
<hr>
|
<hr>
|
||||||
<p>Lovely.</p>
|
<p>Lovely. We can hide stuff in the <code><details</code>>
|
||||||
|
element:</p>
|
||||||
|
<details>
|
||||||
|
<summary>
|
||||||
|
A short summary of the contents
|
||||||
|
</summary>
|
||||||
|
<p>
|
||||||
|
Hidden gems.
|
||||||
|
</p>
|
||||||
|
</details>
|
||||||
<h2 id="lists">Lists</h2>
|
<h2 id="lists">Lists</h2>
|
||||||
<p>This is a plain old bulleted list:</p>
|
<p>This is a plain old bulleted list:</p>
|
||||||
<ul class="incremental">
|
<ul class="incremental">
|
||||||
|
|||||||
28
index.js
28
index.js
@@ -48,26 +48,16 @@ function setRatios() {
|
|||||||
setRatios();
|
setRatios();
|
||||||
|
|
||||||
function checkOffsets() {
|
function checkOffsets() {
|
||||||
const targetNode = document.body;
|
const elements = document.querySelectorAll("body :not(.debug-grid, .debug-toggle)");
|
||||||
const config = { childList: true, subtree: true };
|
for (const element of elements) {
|
||||||
|
const offset = element.offsetTop % 10;
|
||||||
const callback = () => {
|
if(element.offsetParent == document.body && offset > 0) {
|
||||||
const elements = document.querySelectorAll("body :not(.debug-grid, .debug-toggle)");
|
element.classList.add("off-grid");
|
||||||
for (const element of elements) {
|
console.error("Incorrect vertical offset:", element, element.offsetTop % 20);
|
||||||
const offset = element.offsetTop % 10;
|
} else {
|
||||||
if(element.offsetParent == document.body && offset > 0) {
|
element.classList.remove("off-grid");
|
||||||
element.classList.add("off-grid");
|
|
||||||
console.error("Incorrect vertical offset:", element, element.offsetTop % 20);
|
|
||||||
} else {
|
|
||||||
element.classList.remove("off-grid");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
callback();
|
|
||||||
|
|
||||||
const observer = new MutationObserver(callback);
|
|
||||||
observer.observe(targetNode, config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const debugToggle = document.querySelector(".debug-toggle");
|
const debugToggle = document.querySelector(".debug-toggle");
|
||||||
|
|||||||
Reference in New Issue
Block a user