Skip to content

Commit

Permalink
Tweak ScaledText style to prevent the font descender from getting cro…
Browse files Browse the repository at this point in the history
…pped out
  • Loading branch information
eason9487 committed Sep 23, 2022
1 parent f91b180 commit b257ada
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,15 @@ $gla-campaign-preview-height: 270px;

// Display smaller font sizes than browsers' limitations.
&__scaled-text {
height: 1em;
transform: scale(0.5);
transform-origin: top left;
margin-right: -100%; // Inner shrinkage for offsetting the outer horizontal gap caused by 0.5 times scaling.
margin-bottom: -0.5em; // Inner shrinkage for offsetting the outer vertical gap caused by 0.5 times scaling.
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
line-height: 1;
line-height: 0.9; // With 1em height, it prevents the font descender from getting cropped out.
font-size: 20px;

&--smaller {
Expand All @@ -125,6 +126,9 @@ $gla-campaign-preview-height: 270px;
}

&--ad-badge {
// Reset height and line-height because ad badge holds enough height for font descender.
height: auto;
line-height: 1;
// The same vertical inner shrinkage as above.
// A: Height of badge = &--ad-badge font-size + vertical padding
// B: Height of text after badge = &--smaller font-size
Expand Down

0 comments on commit b257ada

Please sign in to comment.