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

Background-image/color full width!

Hello guys,...I would like to achieve full background image/color on my website using <div> element. i want it to be full in that it fits the white parent background color... kindly the CSS code ?

16th Aug 2018, 8:54 PM
COSMUS NGUAH
COSMUS NGUAH - avatar
2 Answers
0
do you mean that the width and/or height are as big as the screen? then use width:100vw and height:100vh
16th Aug 2018, 9:01 PM
Roel
Roel - avatar
0
<div> </div> div{ background-color: green; background-image: url("image.png"); } or <div><img src="image.png"/></div> div{ background-color: green; } img{ width: 100%; object-fit: fill; }
18th Aug 2018, 4:16 AM
RomatoPotato
RomatoPotato - avatar