简体   繁体   English

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

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

For my new website, I'm trying to make the background stay as the background, and to make the paragraph tag sit by itself.对于我的新网站,我试图让背景保持作为背景,并使段落标签独立存在。 I don't want for the background to make different rectangles with the background inside them, I want the background to be one whole thing.我不希望背景制作不同的矩形,里面有背景,我希望背景是一个整体。 Here is the HTML:这是 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>

Here's the website URL: https://zippernet.000webhostapp.com/index.html这是网站网址: https : //zippernet.000webhostapp.com/index.html

I interpret your question to mean that you want the gradient to cover the full width and height of the browser window.我将您的问题解释为您希望渐变覆盖浏览器窗口的整个宽度和高度。 If that is correct, the following CSS should help you solve your problem.如果这是正确的,以下 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