根據Bootstrap4文檔,我們設計了用於設計頁面佈局的類col-*-num
和offset-*-num
。在下面的代碼div列從sm
到up是相同的,只有extra small
視圖有不同的列。因此,作爲bootstrap3,我使用col-sm-*
爲small
來查看視圖,col-xs-*
爲extra small
視圖。在small
和以上的意見一切正常,但令人驚訝的是,在extra-small
查看每div
佔據一排!我認爲我在bootstrap4概念上出了問題,出了什麼問題?引導程序4網格佈局未按預期工作
HTML
<body>
<div id="top-ribbon" class="container-fluid">
<div class="row align-items-center">
<div id="logo" class="col-xs-2 offset-xs-1 col-sm-2 offset-sm-2 d-flex align-items-center justify-content-center color-white">Hello
</div>
<div id="socials" class="col-xs-3 offset-xs-2 col-sm-2 offset-sm-6 d-flex align-items-center justify-content-around color-white">
0256666666<i class="fa fa-phone color-white"></i>
</div>
</div>
</div>
</body>
的CSS
#top-ribbon{
background-color: rgb(168, 8, 133);
}
#socials i{
font-size: 20px;
}
#socials, #logo{
border: 1px solid;
}
.color-white{
color: white;
}
#top-ribbon1{
background-color: rgb(168, 8, 133);
}
#socials1 i{
font-size: 20px;
}
#socials1, #logo1{
border: 1px solid;
}
可能的複製[網格中bootstrap4的α-6 intresting行爲(https://開頭計算器.com/questions/42462902/grid-in-bootstrap4-alpha-6-intresting-behavior) – ZimSystem