This CSS quirk is quite interesting...
An inline-block container will correctly calculate width when using units like px, vw, em, etc. But it behaves differently when using a percentage-based measurement.
Percentage Example: https://i.sstatic.net/saI0M.jpg Pixels Example (which is correct): https://i.sstatic.net/MCWey.jpg
Here's the HTML:
.clip{
width: 100%; overflow:hidden;
position:relative;
}
.show-width-con{
min-width: 100%;
display:inline-block;
white-space:nowrap;
}
.element-perc{
width:24%;
display:inline-block;
vertical-align: top;
position: relative;
}
.element-px{
width:300px;
display:inline-block;
vertical-align: top;
position: relative;
}
<div class="clip">
<div class="show-width-con">
<div class="element-perc">25%</div>
<div class="element-perc">25%</div>
<div class="element-perc">25%</div>
<div class="element-perc">25%</div>
<div class="element-perc">25%</div>
<div class="element-perc">25%</div>
</div>
</div>
<br><br>
<div class="clip">
<div class="show-width-con">
<div class="element-px">300px</div>
<div class="element-px">300px</div>
<div class="element-px">300px</div>
<div class="element-px">300px</div>
<div class="element-px">300px</div>
<div class="element-px">300px</div>
</div>
</div>
Check out the code snippet on Codepen: https://codepen.io/digitalzoomstudio/pen/BYWEoG