Home > Article > Web Front-end > What does auto mean in css
Auto in css means automatic adaptation, and auto in css is often the default value. For example, the code "margin:0 auto" means that the top and bottom margins are 0, and the left and right margins are auto, that is Automatically adapt.
The operating environment of this article: Windows7 system, HTML5&&CSS3 version, Dell G3 computer.
What does auto in css mean?
auto in css means automatic adaptation, and auto in css is often the default value.
Just like margin:0 auto, it means that the top and bottom margins are 0, and the left and right margins are auto, which means automatic adaptation.
However, if you want to use it, you must give the label a specified width, as follows:
<div class="center">居中</div> <style type="text/css"> .center{ width:200px; height:200px; margin:0 auto; background-color:yellow; } </style>
In addition, margin: 0 auto and margin: 0 auto 0 auto have the same effect of. Its four parameters represent top, right, bottom, and left respectively.
means that the top and bottom margins are 0, and the left and right margins automatically adapt to the same width.
For more detailed HTML/CSS knowledge, please visit the CSS Video Tutorial column!
The above is the detailed content of What does auto mean in css. For more information, please follow other related articles on the PHP Chinese website!