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

HTML SVG Basics Introduction to SVG SVGs as Images

Background star not appearing

My code is exactly like the video but my image does not appear

HTML

<div class="wrapper">

 <div class="star">
  <img src="img/star.svg" alt="star">
 </div>

<div class="background-text">
    <p>This text is on top of the image</p>
</div>

</div>

CSS

.star, .background-text{ width: 20%; margin: 1em auto; }

.background-text{ color: #FFF; background:transparent url('../img/star.svg') center center no repeat; height: 300px; }

1 Answer

Hi Azzie,

I took a look at your code. You have only one small error in your CSS. For your .background-text, make sure to include a hyphen for "no-repeat". Your code will now look like this:

.star, .background-text{ width: 20%; margin: 1em auto; }

.background-text{ color: #FFF; background:transparent url('../img/star.svg') center center no-repeat; height: 300px; }

Cheers!

Hi,Thanks it worked but now the text doesn't appear on the image it appears above.