How to set the width of div in html
This article mainly introduces how to set the width of div in html. It is very detailed and has certain reference value. Friends who are interested must finish reading it.
Html div set width method: 1, add "width: width value;" style setting fixed width to div element; 2, add "min-width: width value;" style setting minimum width to div element; 3, add "max-width: width value;" style setting maximum width to div element.
The operating environment of this tutorial: windows7 system, CSS3&&HTML5 version, Dell G3 computer.
1. Use the width attribute
The width property sets the width of the element. (note: the width property does not include padding, borders, and margins! )
Div {border: 1px solid red;} the default div width is adaptive, and the viewport decides to set the div width to 200px.
2. Use the min-width attribute
The min-width property sets the minimum width of the element.
Div {border: 1px solid red;} the default div width is adaptive. It is up to the viewport to set the minimum width of div to 200px.
3. Use the max-width attribute
The max-width property sets the maximum width of the element.
Div {border: 1px solid red;} the default div width is adaptive. It is up to the viewport to set the maximum width of div to 500px.
The above is all the content of the article "how to set the width of div in html". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!