Skip to content

Commit 50de823

Browse files
💄🔧:show enough of the ring to read as round
An SVG with a viewBox cannot stretch: the default preserveAspectRatio letterboxes rather than distorts. So the oval was not the drawing, it was how much of it reached the page. At 375px the circle's centre landed at y=54, behind a navbar 74px tall, leaving only the cap below its widest point. A cap is an oval. Up by a fifth instead of a third puts the centre clear of the navbar at every width, so the curve closes visibly. The svg takes `height: auto` rather than `100%`, so it squares itself off its own ratio instead of depending on the parent's height, and the markup says preserveAspectRatio outright rather than leaning on the default. Signed-off-by: Derek Lewis <DerekNonGeneric@inf.is> Assisted-by: Claude-Code:claude-opus-5
1 parent 0040f1d commit 50de823

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

‎_assets/styles/_home.scss‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,21 @@
108108
color: var(--primary-tint);
109109
pointer-events: none;
110110
opacity: 0.14;
111-
transform: translate(30%, -30%);
111+
112+
// Up by a fifth, not a third. At a third the circle's centre sits behind
113+
// the fixed navbar on a phone, so all that shows is the cap below its
114+
// widest point, and a cap reads as an oval. A fifth keeps the centre clear
115+
// of the navbar at every width, so the curve is legible as a circle.
116+
transform: translate(30%, -20%);
112117
}
113118

119+
// `height: auto` rather than `100%`: with a viewBox the SVG carries its own
120+
// 1:1 ratio, so it squares itself off its width and does not depend on the
121+
// parent's height resolving to anything in particular.
114122
.masthead-ring svg {
115123
display: block;
116124
width: 100%;
117-
height: 100%;
125+
height: auto;
118126
}
119127

120128
// Positioned children paint over static ones, so the content says outright

‎collections/_pages/home.html‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
repeat.
1717
-->
1818
<div class="masthead-ring" aria-hidden="true">
19-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
19+
<svg
20+
xmlns="http://www.w3.org/2000/svg"
21+
viewBox="0 0 100 100"
22+
preserveAspectRatio="xMidYMid meet">
2023
<circle
2124
cx="50"
2225
cy="50"

0 commit comments

Comments
 (0)