Scroll in the body and the space after the block

I don't understand why there is a scroll in the body and a space after the block. According to my logic, I make the margin-bottom 100px and then subtract these 100px from the block height max-height: calc(100% - 100px);

<!DOCTYPE html>
<html>

<head>
    <title></title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <style>
    * {
        padding: 0;
        margin: 0;
        box-sizing: border-box;
    }

    html,
    body {
        height: 100%;
    }

    .example {
        padding: 20px;
        width: 60%;
        margin: 100px auto 0;
        max-height: calc(100% - 100px);
        border: 1px solid black;
        overflow-y: scroll;
    }

    p{
        padding: 100vh 0;
    }
    </style>
</head>

<body>
    <div class="example">
        <div class="text">
            <p>Lorem</p>
            <p>Lorem</p>
        </div>
    </div>
</body>

</html>



Read more here: https://stackoverflow.com/questions/68463567/scroll-in-the-body-and-the-space-after-the-block

Content Attribution

This content was originally published by i like Cola at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: