[英]linear-gradient(…) in CSS3 not working according to specifications?
Here's the current version of my webpage: 这是我网页的当前版本:
<html>
<head>
<title>my site</title>
<style type="text/css">
#mtx_bckgd
{
font-family: Courier New;
height: 1000px;
width: 1000px;
position: absolute;
z-index: -1;
}
#mtx_bckgd > p
{
word-wrap: break-word;
color: #D8D8D8;
overflow: hidden;
}
#header
{
position: absolute;
font-family: Trebuchet MS;
width: 1000px;
height: 70px;
text-align: center;
border: solid 2px #424242;
top: 25px;
font-size: 20;
}
</style>
<script type="text/javascript">
function change_bckgd()
{
var bitstr = "";
for (var i = 0; i < 4000; ++i)
bitstr += Math.floor(Math.random()*10) % 2 ? "0" : "1";
document.getElementById("mtx_txt").innerHTML = bitstr;
}
</script>
</head>
<body>
<div id="mtx_bckgd">
<p id="mtx_txt"></p>
</div>
<div id="header">
<h1>JaminWEB</h1>
</div>
<script type="text/javascript">
setInterval(change_bckgd, 200);
</script>
</body>
</html>
What I plan on doing is creating a vertical fade across the background, from white at the bottom to light grey (the same grey I used for the 0's and 1's in the background) at the top. 我打算做的是在背景上创建垂直的淡入淡出,从底部的白色到顶部的浅灰色(与我在背景中用于0和1的灰色相同)。
According to W3schools ( http://www.w3schools.com/css/css3_gradients.asp ), the syntax 根据W3schools( http://www.w3schools.com/css/css3_gradients.asp ),语法
background: linear-gradient(angle, color-stop1, color-stop2);
means I should add the line 表示我应该添加行
background: linear-gradient(90, white, #D8D8D8)
in the #mtx_bckgd block in the stylesheet. 在样式表的#mtx_bckgd块中。 But when I do that, I'm getting a dark blue fade and my 0's and 1's are turning white.
但是,当我这样做时,我会得到深蓝色的淡入淡出,并且我的0和1变成白色。
The problem is the "90" in background: linear-gradient(90, white, #D8D8D8)
is incorrect. 问题是
background: linear-gradient(90, white, #D8D8D8)
的“ 90” background: linear-gradient(90, white, #D8D8D8)
不正确。 According to W3Schools it should be: 根据W3Schools,它应该是:
background: linear-gradient(90deg, white, #D8D8D8)
or 要么
background: linear-gradient(to right, white, #D8D8D8);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.