Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.