width: auto
width: 100%
An example is worth a thousand words: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style type="text/css"> * { margin: 0;padding: 0; } body { background: #dcdcdc; } .box { width: 400px; border: 3px solid red; padding: 0 50px; } .box1 { width: auto; height: 100px; background: pink; padding: 0 50px; margin: 0 50px; border-width: 0 50px; border-style: solid; border-color: green; } .box2 { width: 100%; height: 100px; background: gold; padding: 0 50px; margin: 0 50px; border-width: 0 50px; border-style: solid; border-color: green; } .box3 { width: 100px;height: 100px;background: orange; } .box4 { float: left; width: 50px;height: 50px;background: pink; } </style> </head> <body> <div class="box"> <div class="box1"></div> <div class="box2"></div> </div> </body> </html> Note: Image sub-width is changed to sub-content This is the end of this article about the detailed explanation of the difference between the default values of the CSS attribute width, width: auto and width: 100%. For more relevant content about CSS width: auto and width: 100%, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. We hope that everyone will support 123WORDPRESS.COM in the future! |
<<: How to migrate the data directory in Docker
>>: Setting z-index property for flash overlay popup layer in web design does not work
This article example shares the specific code of ...
The commands pulled by docker are stored in the /...
Jupyter notebook is configured under the docker c...
Table of contents 1. Use the warehouse to create ...
The hyperlink a tag represents a link point and i...
Table of contents Constructing payment methods us...
This article example shares the specific code of ...
What is a big deal? Transactions that run for a l...
Add the jvm.options file to the elasticsearch con...
Let's take a look at the dynamic splicing of ...
1 Download The address is: https://dev.mysql.com/...
Why are the scroll bars of the browsers and word ...
introduction The company's recent Vue front-e...
This article deploys Jenkins+Maven+SVN+Tomcat thr...
Sometimes MySQL needs to use a function similar t...