对于我的新网站,我试图将背景保持为背景,并使段落标签自行放置。我不想让背景在其中包含背景的情况下制作出不同的矩形,我希望背景成为一体。这是HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=decice-width, initial-scale=1.0" />
<link href="https://fonts.googleapis.com/css?family=Kulim+Park&display=swap" rel="stylesheet">
<title>zippernet</title>
<style>
body {
background: rgb(2,0,36);
background: linear-gradient(10deg, rgba(2,0,36,1) 0%, rgba(80,80,255,1) 100%, rgba(0,212,255,1) 100%);
}
p, h1, h2, h3, h4, h5, h6 {
font-family: 'Kulim Park', sans-serif;
color: white;
}
.rotated-heading {
font-size: 50px;
float: right;
}
</style>
</head>
<body>
<p class="rotated-heading">Welcome to zippernet!</p>
</body>
</html>
答案 0 :(得分:0)
我将您的问题解释为意味着您希望渐变覆盖浏览器窗口的整个宽度和高度。如果正确,那么以下CSS应该可以帮助您解决问题。
html {
height: 100%;
}
body {
height: 100%;
background: rgb(2,0,36);
background: linear-gradient(10deg, rgba(2,0,36,1) 0%, rgba(80,80,255,1) 100%, rgba(0,212,255,1) 100%);
background-repeat: no-repeat;
background-size: cover;
}
p, h1, h2, h3, h4, h5, h6 {
font-family: 'Kulim Park', sans-serif;
color: white;
}
.rotated-heading {
font-size: 50px;
float: right;
}