大家好,我正在为我的大学元素制作一个网站,我不太擅长使用 Dreamweaver CS6。我在 photoshop 中制作了我的设计,但我很难在我的网站上使用我的渐变背景。我已经尝试了几次让它工作,但它要么重复了很多次,要么填满了一定数量的页面但被切断了。任何帮助将不胜感激提前谢谢你。
这是CSS代码
html body
{
background: linear-gradient(to top, #48E7A2 0%, #86C4ED 100%);
background-size:cover;
}
最佳答案
您可以复制此代码。来自 http://www.colorzilla.com/gradient-editor/
您应该在 html{}
而不是 body{}
上使用它
并添加 height:100%;
html {
height: 100%;
background: #48e7a2; /* Old browsers */
background: -moz-linear-gradient(top, #48e7a2 0%, #86c4ed 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#48e7a2), color-stop(100%,#86c4ed)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #48e7a2 0%,#86c4ed 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #48e7a2 0%,#86c4ed 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #48e7a2 0%,#86c4ed 100%); /* IE10+ */
background: linear-gradient(to bottom, #48e7a2 0%,#86c4ed 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#48e7a2', endColorstr='#86c4ed',GradientType=0 ); /* IE6-9 */
}
关于css - 渐变背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21555911/