Skip to content

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

@kayomarz

Description

@kayomarz

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions