zoukankan      html  css  js  c++  java
  • css中元素的auto属性值是什么意思,比如margin:0 auto表示什么?

    auto 你可以理解为一种 自动/自适应 的概念 比如 现在项目需要一个宽度为960px的整体布局居中 
    根据用户浏览器大小不同你将需要使用margin:0 auto;来实现。 无论用户浏览器宽度为多少。
    960px的定位宽度永远居中。

    css中的auto是自动适应的意思,而在css中auto往往都是默认值。

    正如margin:0 auto,意思就是上下边距为0,左右边距为auto,就是自动适应。
    但是,如果要使用他的话,就必须给标签配上指定的宽度,如下:
    <div class="center">居中</div>
    <style type="text/css">
    .center{
    200px;

    height:200px;

    margin:0 auto;

    }
    </style>
    另外,margin:0 auto 和 margin: 0 auto 0 auto 的效果是相同的。
    都是指的上下边距为0,左右边距自动适应宽度相等。
  • 相关阅读:
    产品微谈
    SVN回滚机制
    super究竟是个啥?
    PM12条
    CocoaPods初体验
    UIView局部点击
    Memory cycles about Block
    About "self"
    openfire学习(一)
    WPF菜单和布局(2)
  • 原文地址:https://www.cnblogs.com/Edliu/p/6883793.html
Copyright © 2011-2022 走看看