Set min-width and max-width of an element using CSS

To set the minimum and maximum width of an element, you can try to run the following code

Example


   
      
   
   
      

Below is a div with maximum and minimum width. Resize the web browser to see the effect.

     
This is demo text. This is demo text. This is demo text.          This is demo text. This is demo text. This is demo text.          This is demo text. This is demo text. This is demo text.      
   

Output

Updated on: 2026-03-11T22:50:41+05:30

450 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements