max-width
CSS max-width Property
The CSS max-width property is used to specify the maximum width an element can grow to be. Use with min-width to create a width range for the element.
The example below creates a width range in which the element cannot be less than 300px wide, and cannot be more than 400px wide. To see the effect run this code in a new html document, and slowly resize your browser window horizontally making it smaller.
Example: "200px"
percentage
Example: "25%"
none
Example: "none"
The example below creates a width range in which the element cannot be less than 300px wide, and cannot be more than 400px wide. To see the effect run this code in a new html document, and slowly resize your browser window horizontally making it smaller.
CSS CODE EXAMPLE
<!DOCTYPE html>
<style type="text/css">
#myDiv {
max-width: 400px;
min-width: 300px;
background: #FFCAFF;
height: 120px;
}
</style>
<div id="myDiv">Div content ...</div>
<style type="text/css">
#myDiv {
max-width: 400px;
min-width: 300px;
background: #FFCAFF;
height: 120px;
}
</style>
<div id="myDiv">Div content ...</div>
Div content ...
Possible Values:
numberExample: "200px"
percentage
Example: "25%"
none
Example: "none"
0 Response to "max-width"
Post a Comment