CSS CSS3 渐变背景
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11719019/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 04:38:03 来源:igfitidea点击:
CSS3 gradient background
提问by Alessandro
Is this right to apply gradient background to the body from a light shade of grey to white from bottom to top?
将渐变背景从浅灰色到白色从下到上应用到身体是否正确?
body {
background: -webkit-gradient(linear, bottom, top, from(#e7e7e7, to(#ffffff));
}
回答by Zoltan Toth
DEMOto support all capable browsers
DEMO支持所有有能力的浏览器
body {
background-color: #ffffff;
background-image: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#999999));
background-image: -webkit-linear-gradient(top, #ffffff, #999999);
background-image: -moz-linear-gradient(top, #ffffff, #999999);
background-image: -o-linear-gradient(top, #ffffff, #999999);
background-image: linear-gradient(to bottom, #ffffff, #999999);
}
CSS3 Pleasemight be useful
CSS3 请可能有用
回答by Dave Salomon
To Zoltan's solution, you could also add:
对于 Zoltan 的解决方案,您还可以添加:
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#999999');
to support older IE browsers.
以支持较旧的 IE 浏览器。