雜記 CSS佈局

1. 側邊欄的高度自適應,如圖:

右邊的其他方式登錄的白色豎條div要根據下面的內容自適應高度。這個頁面總的佈局是:

<div class="head"></div>

<div class="body">

    <div class="登錄"></div>

   <div class="其他方式登錄">

       <button>可能有多個按鈕</button>

   </div>

</div>

<div class="foot"></div>

1.1 其中的body爲了能水平居中,所以有以下屬性:

margin: 0 auto;

display:flex;
direction:row;  

 爲了讓子div能高度自適應,所以再添加屬性:

align-items: flex-start;

這個屬性是讓它的兩個div能頂端對齊。

1.2 其中的 class="其他方式登錄" 爲了讓子button水平居中,添加屬性:

display:inline-block;
text-align:center;

又爲了能高度自適應,添加屬性:

height:auto;

1.3其中的button不需要做什麼特別的處理

 

 

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章