Abd*_*UMI 1 css user-interface
我想要一个涵盖整页的背景。
我添加Style
到body
标签。
默认情况下,背景是重复的。
当我添加时background-repeat:no-repeat
,没有重复但颜色没有出现在整页上。
我们添加这些属性:
-moz-background-size: cover;
-webkit-background-size: cover;
-o-background-size: cover;
background-size: cover;
Run Code Online (Sandbox Code Playgroud)
不过,没有新意。
您需要设置height
for<html>
和<body>
html, body {
height: 100%;
}
Run Code Online (Sandbox Code Playgroud)
.your_gradient_class {
/* Your gradient declaration goes here */
background-attachment: fixed; /* Add this */
}
Run Code Online (Sandbox Code Playgroud)
我建议您将渐变应用于<html>
而不是将其设置为<body>
您可能还想看看background-attachment: fixed;
哪些对您的背景有用。
请注意,您不必为此使用background-size: cover;
。
归档时间: |
|
查看次数: |
833 次 |
最近记录: |