What does auto mean in css

醉折花枝作酒筹
Release: 2023-01-04 09:35:51
Original
6841 people have browsed it

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.

What does auto mean in css

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>
Copy after login

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!

Related labels:
css
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!