Background image size | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Background image size

Hello. Just a quick question: What do I need to do, if I want to have only one background image (background-repeat:no-repeat) and need it to shrink (or expand) to fill the whole element with it? https://code.sololearn.com/WL6TVcJNjRZT/?ref=app

29th May 2018, 3:41 PM
Jan Štěch
Jan Štěch - avatar
4 Answers
+ 6
background-size:100% 50% where 100% is the background width and 50% background height
29th May 2018, 3:56 PM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar
+ 2
Check this. There are several methods with which you can do that: https://css-tricks.com/perfect-full-page-background-image/
29th May 2018, 3:48 PM
Mickel
Mickel - avatar
+ 1
try using <div> tag because, both background image and background color cant be displayed in your current code
29th May 2018, 4:16 PM
Arinze Obi
Arinze Obi - avatar
0
Thank you all very much.
29th May 2018, 4:20 PM
Jan Štěch
Jan Štěch - avatar