Skip to content

Commit eda91a7

Browse files
committed
use sass variables to show how admonition icon and title are aligned
1 parent f39142e commit eda91a7

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/pydata_sphinx_theme/assets/styles/content/_admonitions.scss

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ div.admonition,
4040

4141
// Defaults for all admonitions
4242
> .admonition-title {
43+
$padding-top: 0.4rem;
44+
$icon-width: 1rem;
45+
$icon-margin-x: 0.5rem;
46+
4347
margin: 0 -0.6rem;
44-
padding: 0.4rem 0.6rem 0.4rem 2rem;
48+
padding: 0.4rem 0.6rem $padding-top calc($icon-width + 2 * $icon-margin-x);
4549
font-weight: var(--pst-admonition-font-weight-heading);
4650
position: relative;
4751

@@ -54,9 +58,10 @@ div.admonition,
5458

5559
&::after {
5660
position: absolute;
57-
top: 0.5rem;
58-
left: 0.5rem;
59-
width: 1rem;
61+
top: $padding-top; // align icon with title text
62+
left: 0;
63+
margin: 0 $icon-margin-x;
64+
width: $icon-width;
6065
height: 1rem;
6166
color: var(--pst-color-info);
6267
font: var(--fa-font-solid);

0 commit comments

Comments
 (0)