Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line-height:1.15 results in v scroll bar (flexbox) #865

Open
kayomarz opened this issue Aug 9, 2021 · 0 comments
Open

Line-height:1.15 results in v scroll bar (flexbox) #865

kayomarz opened this issue Aug 9, 2021 · 0 comments

Comments

@kayomarz
Copy link

kayomarz commented Aug 9, 2021

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:

  1. html {line-height:1.15} included in normalize code.
  2. 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:

  1. Browsers seem to set default line-height based on font-family.
  2. 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant