Home >Web Front-end >Front-end Q&A >What does auto mean in css
In CSS, the full English name of auto is "automatic", and the Chinese meaning is "automatic adaptation". Auto is often the default value. If there is no value set for the attribute in CSS, the browser client will use the initial value of the attribute for rendering, which is based on browser adaptation.
The operating environment of this tutorial: Windows7 system, CSS3&&HTML5 version, Dell G3 computer.
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:
<style type="text/css"> .center{ width:200px; height:200px; margin:0 auto; } </style> <div class="center">居中</div>
In addition, margin:0 auto
and margin : 0 auto 0 auto
The effect is the same.
means that the top and bottom margins are 0, and the left and right margins automatically adapt to the same width.
Recommended learning: css video tutorial
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!