Home >Web Front-end >Front-end Q&A >What does auto mean in css

What does auto mean in css

藏色散人
藏色散人Original
2021-04-29 10:06:036822browse

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.

What does auto mean in css

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn