mercredi 8 février 2017

why rem will break flex layout even if you don't use it

Vote count: 0

<!DOCTYPE html>
<html>
<head>

<link rel="icon" href="data:;base64,iVBORw0KGgo=">
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

<style>
    * {margin: 0;padding: 0; box-sizing: border-box;}
    html { 
        overflow: scroll; 
        min-height: 100%;
        display: flex;
        font-size: 62.5%; 
    }
    body{
        display: flex;
        flex: 1;
    }

    .chats {
        flex:  1;
        display: flex;
        flex-direction: column;
    }
    p{
        padding: 10px;
    }
    .box{
        background: blue;
        flex: 1;
    }
    .random{
       /* padding-top:1rem; */
        /* try to un-commnet this rule and the observe the blue box, it will be very small */
    }
</style>
</head>
<body>
    <div class="chats">
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing 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>
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
                tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
                quis nostrud exercitation ullamco .</p>
        <div class="box">box</div>
    </div>
</body>
</html>

problem: if I uncomment the rule .random. the layout will break, even though I'm not using any in the html

reproduce: you need to view this code on mobile (safari/chrome)

screen shot:

without rule .random

enter image description here

with rule .random enter image description here

asked 17 secs ago

Let's block ads! (Why?)



why rem will break flex layout even if you don't use it

Aucun commentaire:

Enregistrer un commentaire