• margin-left:auto;margin-right:auto; 不起作用的原因


    1.  是否添加

    过渡的(Transitional):要求非常宽松的DTD,它允许你继续使用HTML4.01的标识(但是要符合xhtml的写法),完整代码如下:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    2. 

    .divCenter {
    /* float: left; */
    225px;
    margin-left: auto;
    margin-right: auto;
    }

    请设置元素宽度, 不要增加float属性。

    例子如下直接使用就是居中

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <style>
    .divCenter {
    /* float: left; */

    display:block;

    325px;
    height:200px;
    margin-left: auto;
    margin-right: auto;
    background:#eee;
    }
    </style>

    <div style='float:left;1000px;height:300px;background:#666;'>
    <div class='divCenter'></div>
    </div>

  • 相关阅读:
    gdb常用命令
    gdb之watch命令
    gdb之x命令
    python's descriptor II
    MacOSX快捷键
    主题敏感词PageRank
    shell调试选项
    shell输出调试信息
    事务时间如何去掉wasted time
    深刻剖析VuGen脚本录制原理
  • 原文地址:https://www.cnblogs.com/yuzhould/p/12522705.html
Copyright © 2020-2023  润新知