I am facing an issue with my header containing a logo when I apply the box-sizing: border-box
reset.
Here is the functional header:
.header-container {
height: 60px;
width: 100%;
background-color: #333333;
color: white;
display: flex;
justify-content: space-between;
}
.app-logo {
height: 30px;
padding: 15px 20px;
}
.app-logo img {
height: 100%
}
<div class="header-container">
<div class="app-logo">
<img src="https://upload.wikimedia.org/wikipedia/commons/3/3b/Flag_of_Montenegro_%281993-2004%29.png">
</div>
</div>
Now, here is the problematic one:
html {
box-sizing: border-box
}
*, *:before, *:after {
box-sizing: inherit
}
.header-container {
height: 60px;
width: 100%;
background-color: #333333;
color: white;
display: flex;
justify-content: space-between;
}
.app-logo {
height: 30px;
padding: 15px 20px;
}
.app-logo img {
height: 100%
}
<div class="header-container">
<div class="app-logo">
<img src="https://upload.wikimedia.org/wikipedia/commons/3/3b/Flag_of_Montenegro_%281993-2004%29.png">
</div>
</div>
Why does the image inside .app-logo
disappear when box-sizing
is applied?
I attempted to change the height of .app-logo img {height: 30px;}
in pixels, which made the image visible again. However, I would prefer to keep it at 100%
so that the logo's height adjusts to its container.