所以这就是我正在尝试的:
body {
height:100%;
background: -moz-linear-gradient(left, #DB2B39 50%, #2B303A 50%);
background: -webkit-linear-gradient(left, #DB2B39 50%,#2B303A 50%);
background: linear-gradient(to right, #DB2B39 50%,#2B303A 50%);
}
但这只会产生水平分割,而且如果没有条纹就不能轻易地垂直分割似乎很奇怪。
我是否漏掉了一些非常明显的东西?
最佳答案
这是制作水平渐变,因为您将 angle
设置为“向右”。如果您改为放置 to bottom
或 top
,它将生成垂直渐变。
body {
height:100%;
background: -moz-linear-gradient(top, #DB2B39 50%, #2B303A 50%);
background: -webkit-linear-gradient(top, #DB2B39 50%,#2B303A 50%);
background: linear-gradient(to bottom, #DB2B39 50%,#2B303A 50%);
}
请检查 linear-gradient here 的所有值.
关于html - 你可以使用线性渐变属性来做垂直背景颜色吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38964395/