CSS 网站信息标签放置于浏览器底部

CSS About 512 words

需求

对于网站信息的元素块,当页面元素不足以填充满整个浏览器高度时,仍然需要置于底部。

flex 布局

使用flex-direction: columnflex: 1

<!DOCTYPE html>
<html>
<head>
    <style>
        body {
            display: flex;
            flex-direction: column;
        }
        .footer{
            margin-top: auto;
        }
        .main {
            flex: 1;
        }
    </style>
</head>
<body>
    <div class="main">
    </div>
    <div class="footer">
    </div>
</body>
</html>
Views: 121 · Posted: 2024-02-11

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh