Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Example of CSS max-width property</title> <style> p { max-width: 400px; display: inline-block; background: #f0e68c; } div { width: 300px; max-width: 200px; background: #ffc0cb; } </style> </head> <body> <p>Enter some text to see how it works.</p> <div>The maximum width of this div element is set to 200px, so it can't be wider than that.</div> </body>