How can I add a pic to cover a <div> section? I know about href= I just don't know how to add it to cover the <div> section. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How can I add a pic to cover a <div> section? I know about href= I just don't know how to add it to cover the <div> section.

17th Nov 2018, 7:34 AM
GreenBlazer 416
GreenBlazer 416 - avatar
23 Answers
+ 2
Ehhhh 😁 not that code. I sent you this one: https://code.sololearn.com/WYIpX7bD2kxi/?ref=app
21st Nov 2018, 8:48 AM
Matúš Semančík
Matúš Semančík - avatar
+ 3
Ok. Let me go practice and I'll get back to ya. Thanks!
17th Nov 2018, 8:01 AM
GreenBlazer 416
GreenBlazer 416 - avatar
+ 3
Ok now mine looks similar to yours but now I get nothing in output!
21st Nov 2018, 9:41 AM
GreenBlazer 416
GreenBlazer 416 - avatar
+ 3
I do. I got my content back but still no image!
21st Nov 2018, 9:47 AM
GreenBlazer 416
GreenBlazer 416 - avatar
+ 3
So...I'm trying to use a pic from Google drive. Is the url wrong? I getting so frustrated with this coding stuff!
21st Nov 2018, 10:11 AM
GreenBlazer 416
GreenBlazer 416 - avatar
+ 3
Sent
21st Nov 2018, 10:28 AM
GreenBlazer 416
GreenBlazer 416 - avatar
+ 2
<div style="background-image: url('your_url.png'); background-size: cover;"></div>
17th Nov 2018, 7:47 AM
Matúš Semančík
Matúš Semančík - avatar
+ 2
Can I still add class="section"? Example...<div class="section" or does style="background-image: replace and have same effect?
17th Nov 2018, 7:51 AM
GreenBlazer 416
GreenBlazer 416 - avatar
+ 2
Sure You can add class to div and then style that class in css. <style> .section { background-image: url('your_url.png'); background-size: cover; } </style> <div class="section"></div>
17th Nov 2018, 7:54 AM
Matúš Semančík
Matúš Semančík - avatar
+ 2
I added url but no pic shows. Also I'm not sure how to code the CSS page. Can you check it and give me guidance? I want to figure it out myself but I'm not above being given the answer out right lol.
17th Nov 2018, 9:24 AM
GreenBlazer 416
GreenBlazer 416 - avatar
+ 2
Make sure You added some content to div. Check this code out. https://code.sololearn.com/WYIpX7bD2kxi/?ref=app
17th Nov 2018, 9:39 AM
Matúš Semančík
Matúš Semančík - avatar
+ 2
Does the code look right now? Still no image though. I might have to change a setting in drive.
17th Nov 2018, 10:02 AM
GreenBlazer 416
GreenBlazer 416 - avatar
+ 2
That code works for me! Hmmm that is weird.
17th Nov 2018, 10:04 AM
Matúš Semančík
Matúš Semančík - avatar
+ 2
Matus Semancik do you see a pic of a lake at sunset?
21st Nov 2018, 8:08 AM
GreenBlazer 416
GreenBlazer 416 - avatar
+ 2
What do you see when you open my code?
21st Nov 2018, 8:42 AM
Matúš Semančík
Matúš Semančík - avatar
+ 2
Make sure you have some content in your <div>.
21st Nov 2018, 9:43 AM
Matúš Semančík
Matúš Semančík - avatar
+ 2
Can you send me that url please?
21st Nov 2018, 10:26 AM
Matúš Semančík
Matúš Semančík - avatar
+ 2
Finally got the basics done for this code. Thanks SO MUCH to Matus Semancik! I was so ready to give up on this coding thing. Even had a couple days where all I did was open the app to keep up my daily streak and check messages. I just took a moment today to do it again and decided to check a message that Matus had sent and what he sent me was almost the same as I had (with a couple of minor tweaks) and added those tweaks to my code and now my confidence has went back up...a little bit! Now I a little motivation to continue learning. I think I may have been putting too much time without little to no breaks learning and got a little burned out. The only reason I started working with this code again to begin with was to take a break from learning new stuff and to practice a little bit of what I have learned in html before I forgot it and because all of the stuff I have learned since I completed html certificate is mostly like reading something a crazy person has written. I think I will stick to practicing html..
23rd Nov 2018, 8:22 PM
GreenBlazer 416
GreenBlazer 416 - avatar
+ 2
Coding and add to that slowly kinda like I did with this one. Except I will try not to just ask for the question to be answered like I did here. This was a tough challenge though because the link actually had to be altered! I would have never realized that the link had to be changed from what I copy/pasted, even if I had re-read everything 5-10 more times! Thanks again Matus! I might change this one to be a tribute to you instead of the axe-hole I had originally started it for! https://code.sololearn.com/WysOf3UpwhEl/?ref=app
23rd Nov 2018, 8:33 PM
GreenBlazer 416
GreenBlazer 416 - avatar
+ 1
Ok...so how should my HTML page look? Everything is bold now and still no img.
21st Nov 2018, 8:07 AM
GreenBlazer 416
GreenBlazer 416 - avatar