How can i use a photo background in my code ? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 3

How can i use a photo background in my code ?

24th Dec 2020, 5:52 PM
Riselda Rada
Riselda Rada - avatar
6 Respostas
+ 5
there are multiple ways to do this. One is simply using : body { background-img: url ("img.jpg") } One problem I find with this strategy sometimes, is the background is repeated. Another way to do this to make sure the image is not repeated, is this: HTML: <div id="image"></div> CSS: #image { content: ""; position: absolute ; left:0; top:0; width:100%; height: 100%; background:url("img.jpg"); background-size:cover; background-position:center; user-select:none; } Hope this helps!!
27th Feb 2021, 5:41 PM
don't be sad šŸ˜¶
don't be sad šŸ˜¶ - avatar
+ 4
Riselda Rada anytime šŸ˜„
27th Feb 2021, 5:44 PM
don't be sad šŸ˜¶
don't be sad šŸ˜¶ - avatar
+ 2
Thank you šŸ™šŸ»šŸ™šŸ»
25th Dec 2020, 8:25 AM
Riselda Rada
Riselda Rada - avatar
+ 2
don't be sad šŸ˜¶ thats awesome . i am trying . thank you very muchā™„ļø
27th Feb 2021, 5:43 PM
Riselda Rada
Riselda Rada - avatar
+ 1
Use style tag in head tag like this: <head> <style> Body{ background-image: url("image.jpg") } </style> <head>
24th Dec 2020, 6:13 PM
Nitin Kushwaha
Nitin Kushwaha - avatar