13

这里真的很业余的问题 - body background-gradient 在 chrome 中不起作用,很奇怪,我试过了:

background: -webkit-gradient(linear, 0 0, 0 bottom, from(#FFF), to(#000));

background: -webkit-gradient(linear, 0%, 0%, 0%, 100%, from(#fff), to(#000));

background: -webkit-gradient(linear, center top, center bottom, from(#fff), to(#000));

一切都无济于事!适用于所有其他浏览器...

4

4 回答 4

20

你有没有尝试过:

background: -webkit-linear-gradient(#917c4d, #ffffff);

WebKit 已更新以匹配规范语法,因此您应该拥有它以获得最大的浏览器支持

background: -webkit-gradient(linear, center top, center bottom, from(#917c4d), to(#ffffff));
background: -webkit-linear-gradient(#917c4d, #ffffff);
background: -moz-linear-gradient(#917c4d, #ffffff);
background: -o-linear-gradient(#917c4d, #ffffff);
background: -ms-linear-gradient(#917c4d, #ffffff);
background: linear-gradient(#917c4d, #ffffff);
于 2011-07-22T10:40:06.783 回答
2

所有主流浏览器现在都支持 CSS3 线性渐变标签。

语法需要额外的to. 因此,不要使用 eg 等center top,而是left top使用 eg to toplike

background-image: linear-gradient(to top , #094F86, #4EABDB);
于 2013-12-28T22:20:15.487 回答
1

你有没有试过这个:

<style>
.myawesomegradient{
background:-webkit-gradient(linear, left top, right top, color-stop(0%,#ffffff), color-stop(100%,#000000));
}
</style>

应该在 Safari 和 Chrome 中工作...

于 2011-07-22T10:39:54.733 回答
-1

和你一样,我的 Chrome 浏览器也有问题,但唯一的解决方案是使用内联样式!style = "" 在这里写下你的代码来解决问题

于 2021-09-06T07:48:38.487 回答