Set the maximum width that a box can be with CSS



The max-width property is used to set the maximum width that a box can be. The value of the max-width property can be a number, a length, or a percentage.

Example

<html>    <head>    </head>    <body>       <p style = "max-width:100px; height:200px; border:1px solid green; padding:5px; margin:10px;">          This paragraph is 200px high and max width is 100px          This paragraph is 200px high and max width is 100px       </p>       <img alt = "logo" src = "/css/images/logo.png" width = "100" height = "100" />    </body> </html>
Updated on: 2020-03-04T12:18:06+05:30

139 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements