ampproject / amphtml

The AMP web component framework.
https://amp.dev
Apache License 2.0
14.89k stars 3.89k forks source link

`<amp-fit-text>` ignores CSS that affects text layout #17464

Open sparhami opened 6 years ago

sparhami commented 6 years ago

Originally reported as: https://github.com/ampproject/amp-by-example/issues/1454

When you apply any CSS to <amp-fit-text> that affects the size (e.g. padding, border), the sizing is done without taking any of those properties into consideration.

As a workaround, you can apply the styles to a parent container of <amp-fit-text>, which will affect the the measuring element. This workaround does not work for line-height, since that is set on the measuring Element directly.

ampprojectbot commented 5 years ago

This issue hasn't been updated in awhile. @aghassemi Do you have any updates?

cpapazian commented 5 years ago

line-height is a hard-coded constant, const LINE_HEIGHT_EM_ = 1.15;. We could add an optional attribute to override the constant value. Happy to submit a PR for this ...

aghassemi commented 5 years ago

@sparhami let's verify with amp-truncate-text and close if not an issue there?

TomerAberbach commented 3 years ago

I would like to use amp-fit-text in an email and customize the line height, and I can't use amp-truncate-text because it is not available for email. Any chance we can make it possible to customize the line height as already suggested?

@caroqliu FYI