html - 为什么背景渐变不缩放?

标签 html css gradient

背景中的 CSS 渐变无法缩放,我该怎么办? 打算按百分比做一个HTML布局,但是body渐变太短了。

示例:http://jsfiddle.net/snGVt/

<div class="wrapper">
    <div class="box round"><img src="http://goo.gl/wv4zi" /></div>
    <div class="box round"><img src="http://goo.gl/wv4zi" /></div>
</div>
html{
    height: 100%;
    width:100%;
}

body {
    width:100%;
    background: #0e89b6; /* Old browsers */
    background: -moz-linear-gradient(top,  #0e89b6 0%, #00142c 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#0e89b6), color-stop(100%,#00142c)); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top,  #0e89b6 0%,#00142c 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top,  #0e89b6 0%,#00142c 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top,  #0e89b6 0%,#00142c 100%); /* IE10+ */
    background: linear-gradient(to bottom,  #0e89b6 0%,#00142c 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0e89b6', endColorstr='#00142c',GradientType=0 ); /* IE6-9 */
}

.wrapper {

    width: 60%;
    margin-left: auto;
    margin-right: auto;
}

.box{
    width: 100%;
    margin-top: 10px;
    padding: 25px;
    background-color: #fff;
}

.box > img{
    width: 100%;
}

最佳答案

尝试将 html 宽度和高度样式更改为 "min-height: 100%"和 min-width: 100%"

html{
   min-height: 100%;
   min-width:100%;
}

关于html - 为什么背景渐变不缩放?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15168699/

相关文章:

android - 如何为按钮添加带渐变的波纹效果?

java - 如何在android中将渐变颜色从完全透明设置为深色?

javascript - 浏览器无法识别外部 javascript/jquery 文件的包含

jquery - Jquery 中的工具提示

html - 在可变宽度的 div 内对齐文本

jquery - ASP.Net MVC 4 动态加载 css 文件

android - 如何在 Jetpack compose 中创建角度渐变?

html - CSS - 导航不合适

jquery - topScroll 动画阻止页面在 jquery 中滚动

html - 从 Photoshop 到 html 的背景