Skip to content

Commit 1fe561a

Browse files
author
Tim Bannister
committed
Style diagrams based on intended size
1 parent e9cee73 commit 1fe561a

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

assets/scss/_custom.scss

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,3 +673,45 @@ body.td-documentation {
673673
font-size: inherit !important;
674674
}
675675
}
676+
677+
/* Force size constraints on figures */
678+
figure {
679+
&.diagram-small img {
680+
max-height: clamp(20mm,12em,80vh);
681+
margin-left: auto;
682+
margin-right: auto;
683+
display: block;
684+
}
685+
&.diagram-medium img {
686+
max-height: clamp(25mm,20em,80vh);
687+
margin-left: auto;
688+
margin-right: auto;
689+
display: block;
690+
}
691+
&.diagram-large img {
692+
max-width: clamp(0vw, 95vw, 100%);
693+
max-height: calc(80vh - 8rem);
694+
}
695+
}
696+
697+
@media only screen and (min-width: 768px) {
698+
figure {
699+
&.diagram-small, &.diagram-medium {
700+
max-width: 80%;
701+
}
702+
&.diagram-large {
703+
max-width: 100%;
704+
width: 100%;
705+
}
706+
&.diagram-small img {
707+
max-width: clamp(30rem, 45ch, 100mm);
708+
}
709+
&.diagram-medium img {
710+
max-width: clamp(50rem, 20ch, 160mm);
711+
}
712+
&.diagram-large img {
713+
max-width: clamp(25vw, 95vw, 100%);
714+
max-height: calc(100vh - 10rem);
715+
}
716+
}
717+
}

0 commit comments

Comments
 (0)