Full background image? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Full background image?

Was wondering how to make a background image fullscreen using css.

10th Apr 2018, 1:09 AM
Daniel Cooper
Daniel Cooper - avatar
12 Answers
+ 6
Aaron Stone like this. background-size: 200%; To change background size. Change the Percentage. The Percentage is a width of the background. And the height will be set automatically base on the picture proportion.
10th Apr 2018, 2:14 AM
Warith Vatanaplachaigoon
Warith Vatanaplachaigoon - avatar
10th Apr 2018, 1:37 AM
Warith Vatanaplachaigoon
Warith Vatanaplachaigoon - avatar
+ 4
Daniel Cooper If you want to be cover. You have to set the background size in your own size.
10th Apr 2018, 2:08 AM
Warith Vatanaplachaigoon
Warith Vatanaplachaigoon - avatar
+ 4
Like this that I'd been changed. https://code.sololearn.com/W3sAVV47OOUx/?ref=app
10th Apr 2018, 2:09 AM
Warith Vatanaplachaigoon
Warith Vatanaplachaigoon - avatar
+ 2
That's how you do it... body { background:url("image.jpg"); }
10th Apr 2018, 1:33 AM
Aaron Stone
Aaron Stone - avatar
+ 2
Daniel Cooper Not possible if the width of the image does not allow to
10th Apr 2018, 2:06 AM
Aaron Stone
Aaron Stone - avatar
+ 2
Warith Vatanaplachaigoon How can we do that?:|
10th Apr 2018, 2:09 AM
Aaron Stone
Aaron Stone - avatar
+ 2
10th Apr 2018, 2:14 AM
Aaron Stone
Aaron Stone - avatar
+ 2
Use- <body background="Image Location including image name and extension"> </body>
10th Apr 2018, 2:26 AM
sCiEnCe & tEcH
sCiEnCe & tEcH - avatar
+ 1
I want the image to cover the entirety of the page
10th Apr 2018, 2:03 AM
Daniel Cooper
Daniel Cooper - avatar
+ 1
Try background-size:cover; It will take full width of the screen. You cam set the height if you want.
10th Apr 2018, 5:53 PM
Razvan Wist
Razvan Wist - avatar
+ 1
Also, add background-repeat:no-repeat; That makes the image to not repeat.
10th Apr 2018, 5:54 PM
Razvan Wist
Razvan Wist - avatar