日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

左DIV寬度固定,右DIV適應剩下的寬度

作者:山聞愚 更新時間: 2022-04-11 編程語言
右右右

記錄下兩種方法:

方法一:

.box {
    width: 200px;
    display: flex;
}

.left {
    background-color: red;
    width: 50px;
}

.right {
    background-color: yellow;
    flex-grow: 1;
}

這種方法有一個問題,當右邊的內容超過寬度,左邊會壓縮到只顯示內容。暫時不知道解決的辦法。

方法二:

.box {
    width: 200px;
    overflow: hidden;
}

.left {
    background-color: red;
    width: 50px;
    float: left;
}

.right {
    background-color: yellow;
    width: calc(100% - 50px);
    float: left;
}

?

?

?

?

原文鏈接:https://blog.csdn.net/xjj1314/article/details/119984327

欄目分類
最近更新