Clamp Responsive Width

clamp() keeps width within a safe range.

Preview

Code

<style>
.box{
width:clamp(200px, 50%, 600px);
background:#8b5cf6;
height:60px;
}
</style>

<div class="box"></div>

More CSS Math Functions Examples (8)