Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Background turns white when i scroll down, where am I goign wrong? (I'm new to this)

My problem is that my background to my website always turns white whenever I scroll down.

<div align="center"><img src="bakrund.jpg" class="bg"></div>

.bg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: -5000;
}
like image 923
user2373095 Avatar asked Jan 25 '26 21:01

user2373095


2 Answers

You should use the background attribute of body in your css to define the background image, like this:

body
{
    background-image:url('bakrund.jpg');
} 

Don't try to hack it in using a div.

like image 65
chtenb Avatar answered Jan 28 '26 13:01

chtenb


If you're trying to set a background image do this

    <style>body { background-image:url("YOURURL"); } </style>

It's much easier and is a lot more professional.

like image 35
Jayden Michael Ireland Avatar answered Jan 28 '26 11:01

Jayden Michael Ireland



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!