久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      css居中對(duì)齊怎么設(shè)置

      css居中對(duì)齊的設(shè)置方法:1、水平居中【text-align:center】;2、水平居中【margin:0 auto】;3、垂直居中【line-height】;4、使用表格,水平、垂直居中;5、彈性布局,水平、垂直居中。

      css居中對(duì)齊怎么設(shè)置

      本教程操作環(huán)境:windows7系統(tǒng)、css3版,DELL G3電腦。

      css居中對(duì)齊的設(shè)置方法:

      1、text-align:center —— 水平居中

      僅對(duì)文字、圖片、按鈕等行內(nèi)元素有效(display設(shè)置為inline或inline-block等)進(jìn)行水平居中

      2、margin:0 auto; —— 水平居中

      僅水平居中,且對(duì)浮動(dòng)元素定位無(wú)效

       .father{            width:500px;            height:200px;            background-color::#f98769;            overflow:hidden;//不可缺少否則margin-top不生效        }         .son{             width: 100px;             height: 100px;             margin:50px auto ;             background-color: #ff0000;         }

      3、line-height —— 垂直居中

      line-height=height ,僅對(duì)一行文字有效

      4、使用表格 —— 水平、垂直居中

      對(duì)td/th的align=‘center’和valign=‘middle’兩屬性可以水平和垂直居中

      5、彈性布局 —— 水平、垂直居中

      .father{ display:flex; justity-content:center; align-items:center; } .father{ display:flex; flex-direction:column;//改變主軸為cross axis justity-content:center; }

      6、使用display:table-cell —— 水平、垂直居中

      對(duì)于那些不是表格的元素,我們可以通過(guò)display:table-cell 來(lái)把它模擬成一個(gè)表格單元格

      .father{     height:300px;     background:#ccc;     display:table-cell; /*IE8以上及Chrome、Firefox*/     vertical-align:middle; /*IE8以上及Chrome、Firefox*/     text-align:center;  }  .son{  display:inline-block;//或是inline  }

      7、奇淫技巧——子絕父相(已知子元素寬高) —— 水平、垂直居中

      .father{ position:relative; } .son{//m、n為子盒子寬、高的一半 position:absolute; left:50%; top:50%; margin-left:-mpx; margin-top:-npx;

      8、未知子元素寬高 —— 水平、垂直居中

      .father {     position:relative; } .son {     position:absolute;     top:50%;     left:50%:     transform:translate(-50%,-50%) /*單獨(dú)設(shè)置transform:translateY(-50%);*/ }

      9、偽元素法 —— 垂直居中

      .father{     position: relative; } .father::before{     content: " ";     display: inline-block;     height: 100%;     width: 1%;     vertical-align: middle; } .son{     display: inline-block;     vertical-align: middle; }

      相關(guān)教程推薦:CSS視頻教程

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)