Skip to content

Commit 77e83c3

Browse files
Feat: Mobile-responsive callouts + txt-s adjustments (#89)
* adjust txt-s to target all descendants - also increase line-height slightly from 1rem to 1.2rem * Feat: mobile-responsive callouts + line-height fix - Callouts by default will have their `float` property unset on mobile, and will stretch to 100% width. - adding `|fixed` callout metadata will force a callout to maintain its float on mobile, for exceptional situations where it is important to float a (preferably small) element even with limited screen space (i.e., mobile). - adjustments to `txt-s` line-height for `<sup>` elements (i.e., footnotes) so they don't push line-height up. Slightly increased line-height as compromise to improve readability. Quartz-only; not needed for Obsidian. - reduced line-height of table `<td>` for infobox callouts - updated docs
1 parent 4a62389 commit 77e83c3

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

quartz/styles/custom/callout-adjustments.scss

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@
1616
margin-left: 8px;
1717
}
1818

19+
@media screen and (max-width: $mobileBreakpoint) {
20+
.callout.callout.callout.callout[data-callout-metadata~=right]:not(.callout[data-callout-metadata~=fixed]), .callout.callout.callout.callout[data-callout-metadata~=left]:not(.callout[data-callout-metadata~=fixed]) {
21+
float: unset;
22+
margin: auto;
23+
width: 100%;
24+
max-width: 100%;
25+
/* floating callouts lose float and expand to full width on mobile */
26+
}
27+
}
28+
1929
.callout.callout.callout[data-callout-metadata~=center] {
2030
display: block;
2131
margin: auto;
@@ -214,9 +224,20 @@
214224
}
215225

216226
.callout.callout:is([data-callout-metadata~=text-small],
217-
[data-callout-metadata~=txt-s]) > .callout-content > * {
227+
[data-callout-metadata~=txt-s]) > .callout-content * {
218228
font-size: 0.8rem;
219-
line-height: 1rem;
229+
line-height: 1.3rem;
230+
}
231+
232+
.callout.callout.callout:is([data-callout-metadata~=text-small],
233+
[data-callout-metadata~=txt-s]) > .callout-content sup:has(a), .callout.callout.callout:is([data-callout-metadata~=text-small],
234+
[data-callout-metadata~=txt-s]) > .callout-content sup a {
235+
/* prevents sup elements like footnotes from pushing up line-height. Quartz-only; not needed for Obsidian */
236+
font-size: 0.6rem;
237+
line-height: 0;
238+
position: relative;
239+
vertical-align: baseline;
240+
top: -0.3em;
220241
}
221242

222243
.callout:is([data-callout-metadata~=n-th],

tes3cs-content/.obsidian/snippets/mmw-callout-adjustments.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@
1111
margin-left: 8px;
1212
}
1313

14+
@media screen and (max-width: 767px) {
15+
.callout.callout.callout.callout[data-callout-metadata~=right]:not(.callout[data-callout-metadata~=fixed]), .callout.callout.callout.callout[data-callout-metadata~=left]:not(.callout[data-callout-metadata~=fixed]) {
16+
float: unset;
17+
margin: auto;
18+
width: 100%;
19+
max-width: 100%;
20+
/* floating callouts lose float and expand to full width on mobile */
21+
}
22+
}
23+
1424
.callout.callout.callout[data-callout-metadata~=center] {
1525
display: block;
1626
margin: auto;

0 commit comments

Comments
 (0)