About body background | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

About body background

I got <body background="ula2.jpg"> although this image is not large and wide enough and that's why I ask you how I can put my background image at 100% .. 'cause I've done it before but I used to download images with the exact measures, but I don't which sintaxis I can use to manipulate ;) images whenever I want!! thanks

25th Jul 2017, 4:58 AM
Enmanuel Rivas
Enmanuel Rivas - avatar
2 Answers
+ 9
<body style=background-size:cover;background-image:url(source);> <!-- or background-size:100% 100%; -->
25th Jul 2017, 6:22 AM
Valen.H. ~
Valen.H. ~ - avatar
+ 5
/* shrink background image to container size loosing aspect ratio*/ background-size:100% 100%; /* adapt background image to fit in container size keeping aspect ratio, not cropping */ background-size:contain; /* adapt background image to fit in container size, cropping if needed */ background-size:cover; The second solution would require set or unset background-repeat value(s) and maybe background-position, regarding if you want see part of tiling images on horizontal or vertical sides (since container aspect ratio isn't same as background-image ^^)
25th Jul 2017, 6:37 AM
visph
visph - avatar