'Different behaviour with ems and rems in Safari and Chrome
In Chrome
When I decrease the font-size of .box
then .inner-box
scales down accordingly until 0rem (where .inner-box
is completely gone).
In Safari
When I decrease the font-size of .box
then .inner-box
scales down accordingly until it hits exactly 0.6rem and then it stops scaling.
Can anyone explain this behaviour?
body {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.box {
font-size: 2rem;
}
.inner-box {
margin: auto;
height: 10em;
width: 20em;
background: tomato
}
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div class="box">
<div class="inner-box"></div>
</div>
</body>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|