1

When I run my code for my HTML and CSS project, I have a background, which I set in the CSS class. This background is constructed in the HTML file. But it does not seem to cover the entire screen for my computer. When I try to edit the height variable, it doesn't change the height of the background, which leaves me clueless.

.gradient{
   width: 100wh;
   height: 90vh;
   color: #fff;
   background: radial-gradient(#EE7752, #CF22E7);
   background-size: 400% 400%;
   -webkit-animation: Gradient 10s ease infinite;
   -moz-animation: Gradient 10s ease infinite;
   animation: Gradient 10s ease infinite;
}

<div class="jumbotron text-center gradient">
    <div class="content">
        <p class="lead" style="color:#FFFFFF"></p>
    </div>
</div>
Papershine
  • 4,995
  • 2
  • 24
  • 48

4 Answers4

2

you can add this one background-size: 300px 100px, cover;

.gradient{
width: 100wh;
height: 90vh;
color: #fff;
background: radial-gradient(#EE7752, #CF22E7);
background-size: 300px 100px, cover !important;
-webkit-animation: Gradient 10s ease infinite;
-moz-animation: Gradient 10s ease infinite;
animation: Gradient 10s ease infinite;
}

<div class="jumbotron text-center gradient">
    <div class="content">
        <p class="lead" style="color:#FFFFFF"></p>
    </div>
</div>
Mohammad Malek
  • 624
  • 1
  • 7
  • 17
0

you can add background-size:cover to your css instedof background-size:400% 400%

Ahmad
  • 73
  • 3
  • 13
0

.gradient{
width: 100wh;
height: 90vh;
color: #fff;
background: radial-gradient(#EE7752, #CF22E7);
background-size: cover;
-webkit-animation: Gradient 10s ease infinite;
-moz-animation: Gradient 10s ease infinite;
animation: Gradient 10s ease infinite;

}
<div class="jumbotron text-center gradient">
    <div class="content">
        <p class="lead" style="color:#FFFFFF"></p>
    </div>
</div>
0

If you just wish to remove the white space around the edges (e.g. cover the entire screen), it is due to the div being contained in the body element which by default has a margin added by the browser.

Try this:

<style>
body {
    margin: 0;
}
.gradient {
    height: 100vh;
    background: radial-gradient(#EE7752, #CF22E7);
    background-size: 400% 400%;
}
</style>

 <div class="jumbotron text-center gradient">
     <div class="content">
         <p class="lead" style="color:#FFFFFF"></p>
     </div>
 </div>
epsilon42
  • 1,863
  • 13
  • 26