【问题标题】:linear-gradient not full height of body线性梯度不是身体的全高
【发布时间】:2018-01-12 02:20:38
【问题描述】:

我的线性渐变只到 div 的底部。

问题如何确保body线性渐变达到页面的全高?

CODEPEN DEMO

CSS

body {
    top: 0; 
    right: 0; 
    bottom: 0; 
    left: 0;
    background: linear-gradient(to bottom right, #0087e0 50%, #004165 50%, #004165);
    background-size: auto 100%;
    background-repeat: no-repeat;
    background-position: left top;
}

.header {
    background: #FFFFFF;
    width: 100%;
    height: 50px;
}

.wrapper {
    background: #F0F0F0;
    min-height: 600px;
}

@media (max-width: 968px) {
    .text-mobile {
        text-align: center !important;
    }
}

HTML

<div class="container">
    <div class="wrapper"></div>
</div>

【问题讨论】:

    标签: css


    【解决方案1】:

    您需要将html 和body 的高度设置为100%;

    html, body {
        height: 100%;
    }
    

    【讨论】:

      猜你喜欢
      • 2021-11-16
      • 2019-11-17
      • 1970-01-01
      • 1970-01-01
      • 2017-08-19
      • 2019-07-24
      • 1970-01-01
      • 1970-01-01
      • 2020-01-12
      相关资源
      最近更新 更多