You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!DOCTYPE html><style>div{font-size: x-small;line-height:2em;}p{font-size:2rem}.proper{line-height:2;}</style><div>"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
<p>"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p></div><divclass="proper">"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
<p>"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p></div>
As you can see 2 and 2em are identical for the intended target, but it blows up for descending elements, even if in practice usually less dramatically. In fact it's very well possible that most of the line-height declarations above only needed declaring in the first place because of this mistake.
Yes, 200% is the same as 2em. That's what causes the problem above. If 200% is 60px, it's always 60px. It's a one time declaration of the value, it doesn't become "200%" for children. For children it's whatever 200% turned out to be.
Activity
Frenzie commentedon Jul 29, 2021
To illustrate the problem:
As you can see 2 and 2em are identical for the intended target, but it blows up for descending elements, even if in practice usually less dramatically. In fact it's very well possible that most of the line-height declarations above only needed declaring in the first place because of this mistake.
math-GH commentedon Jul 29, 2021
Are there differences between
line-height: 2andline-height: 200%?Frenzie commentedon Jul 29, 2021
Yes, 200% is the same as 2em. That's what causes the problem above. If 200% is 60px, it's always 60px. It's a one time declaration of the value, it doesn't become "200%" for children. For children it's whatever 200% turned out to be.
math-GH commentedon Aug 17, 2021
I see that the base-theme has the same issue, that line-height has
emorpx:/