Skip to content

Commit 08bf992

Browse files
lfranckeclaude
andcommitted
fix: Set width:auto so the logo is not stretched by its own attributes
The previous commit did not fix this and the reasoning behind it was wrong. width/height attributes are presentational hints that set a real width, not merely an aspect-ratio hint. The rule sets height:22px and never width, so the attribute's 199px won over auto and the logo was drawn 199x22 instead of 145.92x22 -- stretched by 36%. Removing the padding in the previous commit made it worse, because the padding had been accidentally shaving 20px off that 199. width:auto hands sizing back to the aspect ratio the attributes imply. Measured over CDP against the built stylesheet: content box 145.92x22 and -0.01% distortion, identical to production. With the image request blocked the box is still 145.92x22, so the space really is reserved before the image arrives, which is the point of the change. The margin-right from the previous commit stays: aspect-ratio sizes the border box, so padding would still be counted inside the ratio. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 8571350 commit 08bf992

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

ui/src/css/header.css

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,20 @@ body {
4343
word-wrap: normal;
4444
}
4545

46-
/* The gap to the right of the logo is a margin, not padding, on purpose: the
47-
* width/height attributes on the img give it an aspect-ratio, and aspect-ratio
48-
* sizes the box named by box-sizing -- which is border-box here, so padding
49-
* would be counted inside the ratio and squash the image by exactly that much. */
46+
/* The img carries width/height attributes so its space is reserved before it
47+
* loads. Two consequences to keep in mind when touching this rule:
48+
*
49+
* width: auto is required, not redundant. Those attributes are presentational
50+
* hints that set a real width, so without it the logo renders at its full 199px
51+
* against a 22px height and stretches by a third. Setting it hands sizing back
52+
* to the aspect ratio the attributes imply.
53+
*
54+
* The gap is a margin, not padding, because aspect-ratio sizes the box named by
55+
* box-sizing -- border-box here -- so padding would count inside the ratio and
56+
* squash the image by exactly that much. */
5057
.navbar-brand .navbar-item:first-child img {
5158
height: 22px;
59+
width: auto;
5260
display: inline-block;
5361
margin-top: -4px;
5462
margin-right: 20px;

0 commit comments

Comments
 (0)