鍍金池/ 問答/HTML5  PHP  HTML/ 移動(dòng)端網(wǎng)頁怎么讓按鈕在底部,或者與底部有少許距離

移動(dòng)端網(wǎng)頁怎么讓按鈕在底部,或者與底部有少許距離

在做移動(dòng)端網(wǎng)頁時(shí),總會(huì)遇到按鈕靠近底部并居中,有內(nèi)容,無內(nèi)容,或內(nèi)容充滿時(shí),它還在底部,請(qǐng)問這怎么做的

那在react中又該怎么做啊

回答
編輯回答
尐懶貓

可以使用flexbox布局。

參考 http://f2ex.cn/flexbox-sticky...

2017年3月30日 09:28
編輯回答
離觴
<style>
        *{
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }
        html,body{
            width: 100%;
            height: 100%;
        }
        .box{
            width: 100%;
            height: 100%;
            background-color: aqua;
        }
        .content{
            height: 80%;
            background-color: red;
        }
        .btn{
            height: 20%;
            padding-top: 5%;
            text-align: center;
        }
        button{
            width: 30%;
            height: 50%;
        }
    </style>
<div class="box">
        <div class="content"></div>
        <div class="btn">
            <button>btn</button>
        </div>
    </div>

或者 flex,思路是一樣的,分成兩塊就可以了

.box{
    display:flex;
    flex-firection-column;
}
.content{
    flex:1;
}
.btn{
    height:100%;
}
2017年6月3日 03:03