normalize.css
normalize.css copied to clipboard
Line-height:1.15 results in v scroll bar (flexbox)
html {line-height:1.15}
used by normalize
leads to an unexpected vertical scroll bar with a basic flexbox layout.
System: Firefox 78.11.0esr (64-bit) on Debian Buster
The below code or this codepen reproduces the issue (which would need the Helvetica
font to be available. If not, maybe you can try some other font too.)
Relevant css properties are:
-
html {line-height:1.15}
included innormalize
code. -
font-family: Helvetica;
included in user code.
If either of the above is removed, the issue goes away.
For a future major release if any, its worth thinking about the use of html{line-height:1.15}
used by normalize because:
- Browsers seem to set default line-height based on
font-family
. - There are related
normalize
issues (612, 735, 769, 783, 788)
Code to reproduce the issue:
<!doctype html>
<html lang="en">
<head>
<title>Unexpected scroll bar</title>
</head>
<style>
html, body {
height: 100%;
margin: 0px;
}
html
{
line-height: 1.15; /* fix: remove just this line. */
}
body {
display: flex;
flex-direction: column;
}
#a {
flex: 1 0 auto;
}
#b {
font-family: Helvetica; /* With Arial, no issue */
flex: 0 1 auto;
}
</style>
<body>
<div id="a">ABCDEFGHIJKLMNOPQRSTUVWXYZ</div>
<div id="b">ABCDEFGHIJKLMNOPQRSTUVWXYZ</div>
</body>
</html>
In my normalize in https://github.com/garrettw/vitals I have this set to line-height: normal;
instead.