CSS網頁布局入門教程5:二列寬度自適應

來源:互聯網
上載者:User

從二列固定寬度入手,開始嘗試二列布局的情況下,左右欄寬度能夠做到自適應,從一列調適型配置中我們知道,設定自適應主要通過寬度的百分比值設定,因此在二列寬度自適應的布局中也同樣是對百分比寬度值的設計,繼續上面的CSS代碼,我們得新定義二列的寬度值:

複製代碼 代碼如下:#left {
background-color: #E8F5FE;
border: 1px solid #A9C9E2;
float: left;
height: 300px;
width: 20%;
}
#right {
background-color: #F2FDDB;
border: 1px solid #A5CF3D;
float: left;
height: 300px;
width: 70%;
}

左欄寬度設定為寬度20%,右欄寬度設定為寬度的70%,看上去像一個左側為導航,右側為內容的常見網頁形式。 xmlns="http://www.w3.org/1999/xhtml">


左列——(AA25.CN)右列——二列寬度自適應(AA25.CN)

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.