在HTML中创建渐变背景

在HTML中创建渐变背景,html,css,gradient,Html,Css,Gradient,我是html新手,目前已经设置了单一颜色的背景。我有代码将背景更改为我想要的渐变色,但我无法让它工作。我创建单色背景的代码部分是: </head> <body> <!--Start of Product Banner--> <body style="background-color:#6e6e6e;"> <div class="row"> <div id="header_region"> <!--Start o

我是html新手,目前已经设置了单一颜色的背景。我有代码将背景更改为我想要的渐变色,但我无法让它工作。我创建单色背景的代码部分是:

</head>
<body>    
<!--Start of Product Banner-->
<body style="background-color:#6e6e6e;">
<div class="row">
<div id="header_region">
<!--Start of Header Logo-->
<div id="logo" class="two_thirds">
.....
我尝试过使用这段代码来让它工作,但似乎可以得到正确的语法。如何实现这种渐变?

转到这个链接,你可以像在Photoshop中那样添加颜色,它会为你创建渐变代码,并且在移动到较旧版本的浏览器时会优雅地降级。

你有两个
标记,孩子有覆盖CSS样式的内联CSS,请修复它并将css应用于主体

body{
/* your code */
}

一个简单的线性渐变,从上到下(
 6e6e
313131
),用于主体标签:

body {
  background: -webkit-linear-gradient(#6e6e6e, #313131); /* For Safari 5.1 to 6.0 */
  background: -o-linear-gradient(#6e6e6e, #313131); /* For Opera 11.1 to 12.0 */
  background: -moz-linear-gradient(#6e6e6e, #313131); /* For Firefox 3.6 to 15 */
  background: linear-gradient(#6e6e6e, #313131); /* Standard syntax */
}

你可以在CSS3中找到更多关于梯度的信息和示例。

不要只是发布一个链接作为答案,如果你要链接到该网站,请包括该网站针对他的情况提供的代码:那是你的网页?在Firefox中看起来不错。它对你有用吗?很有趣,在firefox中看起来很棒,但在chrome中有一个问题。非常感谢。
body {
  background: -webkit-linear-gradient(#6e6e6e, #313131); /* For Safari 5.1 to 6.0 */
  background: -o-linear-gradient(#6e6e6e, #313131); /* For Opera 11.1 to 12.0 */
  background: -moz-linear-gradient(#6e6e6e, #313131); /* For Firefox 3.6 to 15 */
  background: linear-gradient(#6e6e6e, #313131); /* Standard syntax */
}