在下一页中,如果视口高于#container
(600px),则 css 渐变正确渲染。但是如果视口只有 400px,那么在底部 200px(视口外)就缺少渐变。
我该如何解决?
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<title>Test-Site for css gradient</title>
<style type="text/css">
body {
margin: 0;
}
html, body, #body-wrapper {
height: 100%
}
#body-wrapper {
background-repeat: no-repeat;
background-image: -webkit-gradient(
linear,
left top, left bottom,
from(rgba(131,20,20,1)),
to(rgba(243,172,149,1)),
color-stop(0.2, rgba(159,19,24,1)),
color-stop(0.7, rgba(222,0,30,1))
);
background-image:
-webkit-linear-gradient(
top,
rgba(131,20,20,1),
rgba(159,19,24,1) 20%,
rgba(222,0,30,1) 70%,
rgba(243,172,149,1)
);
background-image:
-moz-linear-gradient(
top,
rgba(131,20,20,1),
rgba(159,19,24,1) 20%,
rgba(222,0,30,1) 70%,
rgba(243,172,149,1)
);
background-image:
-o-linear-gradient(
top,
rgba(131,20,20,1),
rgba(159,19,24,1) 20%,
rgba(222,0,30,1) 70%,
rgba(243,172,149,1)
);
background-image:
linear-gradient(
top,
rgba(131,20,20,1),
rgba(159,19,24,1) 20%,
rgba(222,0,30,1) 70%,
rgba(243,172,149,1)
);
}
#container {
max-width: 900px;
margin: 0 auto;
background: #fff;
border: 1px solid black;
height: 600px;
}
</style>
</head>
<body>
<div id="body-wrapper">
<div id="container">
</div>
</div>
</webl:context>
</body>
</html>
编辑:在这里您可以在线查看:Test-Site