fill-avaible
- это то, что ведет себя по-разному в разных браузерах, но если вы добавите width: 100%
, прежде чем его можно будет использовать из того браузера, который его не поддерживает.
body {
display: flex;
height: 100vh;
}
#sidebar {
width: 400px;
height: 100%;
}
#content {
width: 100%;
width: -moz-available;
width: -webkit-fill-available;
width: fill-available;
}
/* Just style related CSS rules, deleting those does not fix the problem. This is just to make the codepen clearer. */
body {
color: white;
font-size: 14pt;
margin: 0;
}
#sidebar {
padding: 20px;
background: #3c3c3c;
}
#content {
padding: 20px;
background: grey;
}
<body>
<div id="sidebar">This should be exactly 400 pixels but it is 336.83px</div>
<div id="content">This should fill the available space and not take space over the sidebar</div>
</body>