Search⌘ K

Fluid Button Width

Explore how to create a responsive button whose width adjusts fluidly between 150 and 300 pixels using only CSS. Learn to apply the clamp() function to control sizing relative to the viewport while maintaining set minimum and maximum widths, all without altering HTML or using JavaScript.

Problem description

You have a standalone <button> element. Write CSS rules so its width adjusts based on the viewport width, never falling below 150px ...