吸底按钮

435 阅读2分钟

1

<!--
 * @Author: shangkuikui
 * @Date: 2020-09-18 15:38:31
 * @LastEditTime: 2020-09-18 15:54:03
 * @LastEditors: shangkuikui
 * @FilePath: /test2/index.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- wrapper是包裹content和footer的父容器 -->
    <div class="wrapper">
        <div class="content">
            <ul>
                <!-- 页面主体内容区域 -->

                <li>1.这是内容,这是内容……</li>
                <li>2.这是内容,这是内容……</li>
                <li>3.这是内容,这是内容……</li>
                <li>4.这是内容,这是内容……</li>
                <li>5.这是内容,这是内容……</li>
                <li>6.这是内容,这是内容……</li>
                <li>7.这是内容,这是内容……</li>
                <li>8.这是内容,这是内容……</li>
                <li>9.这是内容,这是内容……</li>
            </ul>
        </div>
        <div class="footer">
            <!-- 需要做到吸底的区域 -->
            底部按钮
        </div>
    </div>
</body>
<style>
    html,
    body {
        height: 100%
    }

    .wrapper {
        position: relative;
        box-sizing: border-box;
        min-height: 100%;
        padding-bottom: 100px
    }

    .wrapper ul {
        list-style: none
    }

    .wrapper ul li {
        height: 100px;
        background: #add8e6
    }

    .footer {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 100px;
        background: #ffa500
    }
</style>

</html>



2


<!--
 * @Author: shangkuikui
 * @Date: 2020-09-18 15:38:31
 * @LastEditTime: 2020-09-18 15:56:21
 * @LastEditors: shangkuikui
 * @FilePath: /test2/index2.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- wrapper是包裹content和footer的父容器 -->
    <div class="wrapper">
        <div class="content">
            <ul>
                <!-- 页面主体内容区域 -->

                <li>1.这是内容,这是内容……</li>
                <li>2.这是内容,这是内容……</li>
                <li>3.这是内容,这是内容……</li>
                <li>4.这是内容,这是内容……</li>
                <li>5.这是内容,这是内容……</li>
                <li>6.这是内容,这是内容……</li>
                <li>7.这是内容,这是内容……</li>
                <li>8.这是内容,这是内容……</li>
                <li>9.这是内容,这是内容……</li>
            </ul>
        </div>
        <div class="footer">
            <!-- 需要做到吸底的区域 -->
            底部按钮
        </div>
    </div>
</body>
<style>
    html,
    body {
        height: 100%
    }

    .wrapper {
        box-sizing: border-box;
        min-height: 100%;
        padding-bottom: 100px
    }

    .wrapper ul {
        list-style: none
    }

    .wrapper ul li {
        height: 100px;
        background: #add8e6
    }

    .footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 100px;
        background: #ffa500
    }
</style>

</html>

3

<!--
 * @Author: shangkuikui
 * @Date: 2020-09-18 15:38:31
 * @LastEditTime: 2020-09-18 15:57:32
 * @LastEditors: shangkuikui
 * @FilePath: /test2/index3.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- wrapper是包裹content和footer的父容器 -->
    <div class="wrapper">
        <div class="content">
            <ul>
                <!-- 页面主体内容区域 -->

                <li>1.这是内容,这是内容……</li>
                <li>2.这是内容,这是内容……</li>
                <li>3.这是内容,这是内容……</li>
                <li>4.这是内容,这是内容……</li>
                <li>5.这是内容,这是内容……</li>
                <li>6.这是内容,这是内容……</li>
                <li>7.这是内容,这是内容……</li>
                <li>8.这是内容,这是内容……</li>
                <li>9.这是内容,这是内容……</li>
            </ul>
        </div>
        <div class="footer">
            <!-- 需要做到吸底的区域 -->
            底部按钮
        </div>
    </div>
</body>
<style>
    html,
    body {
        height: 100%
    }

    .wrapper {
        min-height: 100%;
        display: flex;
        flex-direction: column
    }

    .content {
        flex: 1
    }

    .content ul {
        list-style: none
    }

    .content ul li {
        height: 100px;
        background: #add8e6
    }

    .footer {
        padding: 20px;
        background: #ffa500
    }
</style>

</html>

4

<!--
 * @Author: shangkuikui
 * @Date: 2020-09-18 15:38:31
 * @LastEditTime: 2020-09-18 15:58:27
 * @LastEditors: shangkuikui
 * @FilePath: /test2/index4.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- wrapper是包裹content和footer的父容器 -->
    <div class="wrapper">
        <div class="content">
            <ul>
                <!-- 页面主体内容区域 -->

                <li>1.这是内容,这是内容……</li>
                <li>2.这是内容,这是内容……</li>
                <li>3.这是内容,这是内容……</li>
                <li>4.这是内容,这是内容……</li>
                <li>5.这是内容,这是内容……</li>
                <li>6.这是内容,这是内容……</li>
                <li>7.这是内容,这是内容……</li>
                <li>8.这是内容,这是内容……</li>
                <li>9.这是内容,这是内容……</li>
            </ul>
        </div>
        <div class="footer">
            <!-- 需要做到吸底的区域 -->
            底部按钮
        </div>
    </div>
</body>
<style>
    html,
    body {
        height: 100%
    }

    .wrapper {
        display: flex;
        min-height: 100%;
        padding-bottom: 62px;
        flex-direction: column
    }

    .content {
        flex: 1
    }

    .content ul {
        list-style: none
    }

    .content li {
        height: 100px;
        background: #add8e6
    }

    .footer {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        padding: 20px;
        background: #ffa500
    }
</style>

</html>

5

<!--
 * @Author: shangkuikui
 * @Date: 2020-09-18 15:38:31
 * @LastEditTime: 2020-09-18 16:00:38
 * @LastEditors: shangkuikui
 * @FilePath: /test2/index5.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- wrapper是包裹content和footer的父容器 -->
    <div class="wrapper">
        <div class="content">
            <ul>
                <!-- 页面主体内容区域 -->

                <li>1.这是内容,这是内容……</li>
                <li>2.这是内容,这是内容……</li>
                <li>3.这是内容,这是内容……</li>
                <li>4.这是内容,这是内容……</li>
                <li>5.这是内容,这是内容……</li>
                <li>6.这是内容,这是内容……</li>
                <li>7.这是内容,这是内容……</li>
                <li>8.这是内容,这是内容……</li>
                <li>9.这是内容,这是内容……</li>
            </ul>
        </div>
        <div class="footer">
            <!-- 需要做到吸底的区域 -->
            底部按钮
        </div>
    </div>
</body>
<style>
    html,
    body {
        height: 100%
    }

    .wrapper {
        min-height: 100%
    }

    .content {
        min-height: calc(100% - 100px)
    }

    .content ul {
        list-style: none
    }

    .content li {
        height: 100px;
        background: #add8e6
    }

    .footer {
        height: 100px;
        background: #ffa500
    }
</style>

</html>

6

<!--
 * @Author: shangkuikui
 * @Date: 2020-09-18 15:38:31
 * @LastEditTime: 2020-09-18 16:01:24
 * @LastEditors: shangkuikui
 * @FilePath: /test2/index6.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- wrapper是包裹content和footer的父容器 -->
    <div class="wrapper">
        <div class="content">
            <ul>
                <!-- 页面主体内容区域 -->

                <li>1.这是内容,这是内容……</li>
                <li>2.这是内容,这是内容……</li>
                <li>3.这是内容,这是内容……</li>
                <li>4.这是内容,这是内容……</li>
                <li>5.这是内容,这是内容……</li>
                <li>6.这是内容,这是内容……</li>
                <li>7.这是内容,这是内容……</li>
                <li>8.这是内容,这是内容……</li>
                <li>9.这是内容,这是内容……</li>
            </ul>
        </div>
        <div class="footer">
            <!-- 需要做到吸底的区域 -->
            底部按钮
        </div>
    </div>
</body>
<style>
    html,
    body,
    .wrapper {
        height: 100%
    }

    .content {
        height: calc(100% - 100px);
        overflow: scroll
    }

    .content ul {
        list-style: none
    }

    .content ul li {
        height: 100px;
        background: #add8e6
    }

    .footer {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        height: 100px;
        background: #ffa500
    }
</style>

</html>