午夜勾魂曲-午夜福利自怕-午夜福利在线观看6080-午夜福利院电影-国产精品毛片AV久久97-国产精品麻豆高潮刺激A片

兩欄布局

2019-11-29    seo達人

兩列布局的幾種方法

html結構

 <div class="content">

      <div class="content-left">

        左側固定200px

      </div>

      <div class="content-right">

        右側自適應

      </div>

 </div>



1.通過float和margin-left

 / 清除瀏覽器默認邊距 /

      {

        margin: 0;

        padding: 0;

      }



      .content{

        overflow: hidden;

      }

      /
脫離文檔流 /

      .content-left {

        float: left;

        width: 200px;

        height: 200px;

        background: red;

      }



      .content-right {

        /
通過margin-left將左邊位置空出 /

        margin-left: 200px;

        background: blue;

        height: 200px;

      }



2.通過 position: absolute;絕對定位

 /
清除瀏覽器默認邊距 /

     
{

        margin: 0;

        padding: 0;

      }



      .content {

        overflow: hidden;

        position: relative;

      }

      / 脫離文檔流 /

      .content-left {

        position: absolute;

        top: 0;

        left: 0;

        width: 200px;

        height: 200px;

        background: red;

      }



      .content-right {

        / 通過margin-left將左邊位置空出 /

        margin-left: 200px;

        background: blue;

        height: 200px;

      }



3.通過flex彈性布局

/ 清除瀏覽器默認邊距 /

      {

        margin: 0;

        padding: 0;

      }



      .content {

        overflow: hidden;

        display: flex;

      }

      .content-left {

          /
除了width: 200px;還可以flex-basis: 200px; /

        width: 200px;

        height: 200px;

        background: red;

      }



      .content-right {

          /
flex:1;將剩余空間分給它 /

        flex: 1;

        background: blue;

        height: 200px;

      }



4.通過 display: table;表格布局

 /
清除瀏覽器默認邊距 /

     
{

        margin: 0;

        padding: 0;

      }



      .content {

        overflow: hidden;

        display: table;

        / 必須給父級定寬不然自適應盒子沒定寬只會由內容撐開 /

        width: 100%;

      }

      .content-left {

        display: table-cell;

        width: 200px;

        height: 200px;

        background: red;

      }



      .content-right {

        display: table-cell;

        background: blue;

        height: 200px;

      }



5.通過inline-block和calc()函數

 / 清除瀏覽器默認邊距 /

      {

        margin: 0;

        padding: 0;

      }



      .content {

        /
必須加font-size=0;把inline-block默認間距去掉,

        不過設置后里面文字不顯示了可以給里面塊設置font-size:20px;

        或者把兩個塊之間的換行刪掉也能去掉間距/

        font-size: 0;

        overflow: hidden;

      }

      .content-left {

        font-size: 20px;

        display: inline-block;

        width: 200px;

        height: 200px;

        background: red;

      }



      .content-right {

        font-size: 20px;

        display: inline-block;

        background: blue;

        height: 200px;

        /
注意calc里的運算符兩邊要有空格 /

        width: calc(100% - 200px);

      }



6.通過float和calc()函數,左右兩塊都要浮動

 /
清除瀏覽器默認邊距 /

     
{

        margin: 0;

        padding: 0;

      }



      .content {

        overflow: hidden;

      }

      .content-left {

        float: left;

        width: 200px;

        height: 200px;

        background: red;

      }

      .content-right {

        float: left;

        background: blue;

        height: 200px;

        / 注意calc里的運算符兩邊要有空格 /

        width: calc(100% - 200px);

      }



7.使用grid布局

 / 清除瀏覽器默認邊距 /

      {

        margin: 0;

        padding: 0;

      }



      .content {

        overflow: hidden;

        display: grid;

        grid-template-columns: 200px 1fr;

        /
grid布局也有列等高的默認效果。需要設置: align-items: start;。 /

        align-items: start;

      }

      .content-left {

        height: 200px;

        background: red;

        /
grid布局還有一個值得注意的小地方和flex不同:在使用margin-left的時候,

        grid布局默認是box-sizing設置的盒寬度之間的位置。

        而flex則是使用兩個div的border或者padding外側之間的距離。 */

        box-sizing: border-box;

        grid-column: 1;

      }

      .content-right {

        background: blue;

        height: 200px;

        box-sizing: border-box;

        grid-column: 2;

      }



日歷

鏈接

個人資料

藍藍設計的小編 http://m.gerard.com.cn

存檔

主站蜘蛛池模板: 怪物高h粗暴无尽 | 精品网站一区二区三区网站 | 国产精品久久久久a影院 | 无码AV精品久久一区二区免费 | 日韩免费一区二区三区在线 | 美女教师朝桐光在线播放 | 国产成人在线视频免费观看 | 国产看黄网站又黄又爽又色 | 俄罗斯搜索引擎Yandex推广入口 | 日本久久久久久久做爰片日本 | 美女医生深夜在家裸睡惨死 | 国产精品18久久久久久欧美网址 | 日本特黄的免费大片视频 | 久久精品国产只有精品 | 草比比过程图 | 国内精品自线在拍2020不卡 | 高肉黄暴NP文公交车 | 中文字幕乱偷无码AV蜜桃 | 99国产在线精品观看二区 | 挺弄抽插喷射HH | 欧美性狂猛AAAAAA | 92午夜理论第1000集 app | 久久久国产精品免费A片蜜臀 | 国产一区免费在线观看 | 国产亚洲精品久久久999蜜臀 | 97精品国产亚洲AV高清 | 亚洲AV蜜桃永久无码精品无码网 | 亚洲视频成人 | 亚洲 日韩 欧美 另类 蜜桃 | 欧洲video60| 亚洲三级在线中文字幕 | 国产超碰人人爱被IOS解锁 | 日本大片免a费观看视频 | 最新精品学生国产自在现拍 | 国产一区二区三区乱码在线观看 | 日本孕妇大胆孕交 | 在线观看国产精美视频 | 免费看欧美xxx片 | 国产在线播放不卡 | 久久中文字幕人妻AV熟女 | 老师湿乎乎两半嫩 |