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

Background image

Hello hopefully someone can help me with my code. For some reason my background image is not covering the whole container/box what could I be doing wrong <section id="showcase"> <div class="container"> <h1>Affordable Proffesional Web Design</h1> <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce suscipit consequat augue eu aliquam. Suspendisse vitae magna vel velit facilisis gravidaLorem ipsum dolor sit amet, </p> </div> </section> .container{ width:80%; margin:auto; overflow:hidden; } #showcase{ min-height:400px; background:url('../img/showcase.jpg') no-repeat 0 -400px; text-align: center; color:#ffffff; }

8th May 2020, 7:32 PM
Joe Trotter
Joe Trotter - avatar
8 Answers
+ 2
try adding background-size:100%; before the text-align tag. but i’m not quite sure if thats what you were looking for.
8th May 2020, 10:43 PM
madeline
madeline - avatar
+ 1
curious: did you want the image to be proportional? or does it matter
8th May 2020, 11:20 PM
madeline
madeline - avatar
+ 1
hi, sry last comment. but this might be it.. https://code.sololearn.com/W3Vn9WyjDvL0/?ref=app
8th May 2020, 11:50 PM
madeline
madeline - avatar
+ 1
thank you so much
9th May 2020, 12:25 AM
Joe Trotter
Joe Trotter - avatar
+ 1
oh you are very welcome
9th May 2020, 12:31 AM
madeline
madeline - avatar
+ 1
You have to make width of container equal to the size of image
10th May 2020, 7:10 AM
𝖆𝖊𝖙𝖍𝖊𝖗
𝖆𝖊𝖙𝖍𝖊𝖗 - avatar
0
i tried that and also giving the showcase ID its own container with a width of 100 % but the problem im running into now is that its not tesppnsive and when i shtink the screen the image kind of dissapears
8th May 2020, 10:56 PM
Joe Trotter
Joe Trotter - avatar
0
You can try to add "background: cover;"
10th May 2020, 2:46 PM
Kayode Kolade Christopher
Kayode Kolade Christopher - avatar