繁体   English   中英

如何使背景不环绕段落标签

[英]How to make the background not wrap around the paragraph tag

对于我的新网站,我试图让背景保持作为背景,并使段落标签独立存在。 我不希望背景制作不同的矩形,里面有背景,我希望背景是一个整体。 这是 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>

这是网站网址: https : //zippernet.000webhostapp.com/index.html

我将您的问题解释为您希望渐变覆盖浏览器窗口的整个宽度和高度。 如果这是正确的,以下 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;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM