Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Html width 100% on image not spreading across the page

Tags:

html

css

I have a background image:

    <div style="background-image: url(images/Home/diamond.png); height: 2600px; width: 100%; border: 1px solid black;"></div>

On the page the image covers all the center and right, but not the left. When I tried width 100%, it did not spread across the page like my other div. If this helps, this div element is a child of a section element and a parent of many other multiple div elements.

like image 758
Qhucy Avatar asked Jan 25 '26 04:01

Qhucy


1 Answers

Try this:

html { 
      background: url(images/Home/diamond.png) no-repeat center fixed; 
      -webkit-background-size: cover;
      -moz-background-size: cover;
      -o-background-size: cover;
      background-size: cover;
    }
like image 136
Jad Chahine Avatar answered Jan 29 '26 03:01

Jad Chahine



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!