Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html CSS使我的背景以颜色显示,并以另一个(类似)颜色背景图像结束:线性渐变_Html_Css_Background_Styling - Fatal编程技术网

Html CSS使我的背景以颜色显示,并以另一个(类似)颜色背景图像结束:线性渐变

Html CSS使我的背景以颜色显示,并以另一个(类似)颜色背景图像结束:线性渐变,html,css,background,styling,Html,Css,Background,Styling,从顶部到底部#3a5976和#2c4762 抱歉,如果很难阅读,请将其复制到您的文本编辑器 <html> <head> <style> body { background-image: linear-gradient(bottom, rgb(70,125,149) 19%, rgb(98,163,179) 60%,

从顶部到底部#3a5976和#2c4762

抱歉,如果很难阅读,请将其复制到您的文本编辑器

<html>
  <head>
    <style>
      body {
        background-image: linear-gradient(bottom, rgb(70,125,149) 19%, 
                          rgb(98,163,179) 60%, 
                          rgb(56,122,122) 80%);
        background-image: -o-linear-gradient(bottom, rgb(70,125,149) 19%, 
                          rgb(98,163,179) 60%, 
                          rgb(56,122,122) 80%);
        background-image: -moz-linear-gradient(bottom, rgb(70,125,149) 19%, 
                          rgb(98,163,179) 60%, 
                          rgb(56,122,122) 80%);
        background-image: -webkit-linear-gradient(bottom, rgb(70,125,149) 19%, 
                          rgb(98,163,179) 60%, 
                          rgb(56,122,122) 80%);
        background-image: -ms-linear-gradient(bottom, rgb(70,125,149) 19%, 
                          rgb(98,163,179) 60%, 
                          rgb(56,122,122) 80%);
           }
    </style>
  </head>
  <body>

  </body>

身体{
背景图像:线性渐变(底部,rgb(70125149)19%,
rgb(98163179)60%,
rgb(56122122)80%;
背景图像:-o-线性梯度(底部,rgb(70125149)19%,
rgb(98163179)60%,
rgb(56122122)80%;
背景图像:-moz线性梯度(底部,rgb(70125149)19%,
rgb(98163179)60%,
rgb(56122122)80%;
背景图像:-webkit线性渐变(底部,rgb(70125149)19%,
rgb(98163179)60%,
rgb(56122122)80%;
背景图像:-ms线性梯度(底部,rgb(70125149)19%,
rgb(98163179)60%,
rgb(56122122)80%;
}

在示例中,用十六进制值替换rgb()值:

body{
background-color: #2c4762; /* fallback for browsers that don't support gradient */
background-image: linear-gradient(bottom, #2c4762, #3a5976 );
background-image: -o-linear-gradient(bottom, #2c4762, #3a5976 );
background-image: -moz-linear-gradient(bottom, #2c4762, #3a5976 );
background-image: -webkit-linear-gradient(bottom, #2c4762, #3a5976 );
background-image: -ms-linear-gradient(bottom, #2c4762, #3a5976 );
}

这里有一把可以使用的小提琴(用“content DIV”代替body):

如果你想看的话,读起来并不难(:你的问题是什么?像这样,可读性更好。thanx,如果我想让它达到特定的数量,那该怎么办?例如,颜色会改变到页面底部,滚动后,它会停止改变,直到颜色不变。我不知道你能做到,因为我从来没有尝试过渐变,但对于图像,你可以设置固定的属性rty类似于
背景附件:已修复;
请参见此处更新的小提琴:(将顶部渐变颜色更改为白色,以便更容易注意)