Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>CSS Set Width Range for an Element</title> <style> div { float: left; min-width: 300px; max-width: 500px; height: 100px; background: #eee8aa; } </style> </head> <body> <p><strong>Note:</strong> The minimum width of the following div element will be 300px, and it can stretches horizontally up to 500px. Enter few lines of text inside the div element to understand how it works.</p> <div></div> </body> </html>