• float后怎么居中


    我们在用css float的时候,如何让文本水平居中真的很麻烦,

    [float]使div(或者其他标签)的宽度自适应其内容,但它却有个弊端:无法居中。
    [display:inline-block]也有同样的特性,并且可以居中,但连续几个这样的东东,之间却会出现空格。

    第一种方案:

    <html>
        <body style="text-align:center">
            <div style="margin:0 auto;">
              <div style="float:left">123243</div>
              <div style="float:left">6576876</div>
              <div style="float:left">2433665</div>
            </div>
        </body>
    </html>

     第二种方案(推荐)

    <html>
        <body style="text-align:center">
            <div style="display:inline-block; *display:inline; zoom:1;">
              <div style="float:left">123243</div>
              <div style="float:left">6576876</div>
              <div style="float:left">2433665</div>
            </div>
        </body>
    </html>
  • 相关阅读:
    python3 网络编程
    python3 字典及其方法
    洛谷P2239 螺旋矩阵
    洛谷P4281 紧急会议
    洛谷 P4427 求和
    树的直径
    洛谷P3398 仓鼠找suger
    洛谷P3865 ST表
    洛谷P1638逛画展
    洛谷P1886 滑动窗口
  • 原文地址:https://www.cnblogs.com/myhappylife/p/3481167.html
Copyright © 2020-2023  润新知