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
.
div.ex2 {
max-width: 500px;
}
div.ex2 {
max-width: 500px;
margin: auto;
border: 3px solid #73ad21;
}
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.