Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Foundations Backgrounds and Borders Background Properties

Isha Srivastava
Isha Srivastava
5,002 Points

query regarding no-repeat value in background-image property!

Hi, actually for just of my practice purpose i was doing this coding..

HTML

     <div class="background">
       <p>Policing Board appoints Drew Harris as Deputy Chief Constable.Thirty mourners as <a href="#">Ian Paisley buried in sight of spot</a> where he addressed crowds</p>

        <h2>Police boss Shaun Wright </h2>
       <p> Police boss Shaun Wright quits in Rotherham sex abuse row,Scottish referendum: Remember Scottish soldiers who died at IRA hands, says MP.</p
      <p>Policing Board appoints Drew Harris as Deputy Chief Constable.Thirty mourners as Ian Paisley buried in sight of spot where he addressed crowds</p>

      </div>

CSS

.background{

 border:2px solid black;
 color:white;
 width: 800px;
 background-image:url("img/numbers-01.jpg");
  background-repeat: no-repeat;
    }

but then i found that whenever i declare no-repeat in background-image property itself then the image goes off from the whole div, i could not find why it is happening,kindly help!!

is the missing ">" on the closing paragraph tag causing it?

Isha Srivastava
Isha Srivastava
5,002 Points

hi, sorry actually while pasting the code here it got missed but actually in my code its proper there..

1 Answer

Wayne Priestley
Wayne Priestley
19,579 Points

Hi Isha,

Can you try a small modification to your css and see how things work.

.background{
   border: 2px solid black;
   color: white;
   width: 800px;
   background :url("img/numbers-01.jpg") no-repeat;
 }

Let me know how it goes, if this doesn't work we can look at it again.

Isha Srivastava
Isha Srivastava
5,002 Points

thank you so much, it worked.