How To Use CSS Max Width Property

CSS Max-width

Note: Understand the CSS width & max-width property.Please keep in mind that max-width does not create a horizontal scroll bar when the browser window size is smaller than the defined max-width while width creates a horizontal scroll bar when the browser window size is smaller than the defined width.

Example

General Syntax

div.ex2 {
 max-width: 500px;
}    

Source Code

Download
div.ex2 {
 max-width: 500px;
 margin: auto;
 border: 3px solid #73ad21;
}

Code Explanation

Note:In this example,CSS width & max-width property is mentioned.To see the difference between these two properties, resize the browser window smaller than the predefined width & max-width & see the differences between these two CSS properties.

Online Test / Quiz

Our Tutorials

Html Tutorial HTML
Css Tutorial CSS
Bootstrap 5 Tutorial BOOTSTRAP 5
Bootstrap 4 Tutorial BOOTSTRAP 4
Materialize CSS Tutorial MATERIALIZE CSS
2021-22 © shapeyourpath.com