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

Set repeat background for SVG?

Hi All,

I'm currently working a project and getting more involved with SVG, this is what I have so far...

<div style="height: 250px; position:absolute; width:100%; bottom:-0.5px;">
<svg height="100%" preserveAspectRatio="none" viewBox="0 0 100 100" width="100%" style="fill:#23282D;"><path d="M100 0 L0 100 L100 100" stroke-width="0"></path>
</svg>
</div>

This currently display a dark gray triangle from left to right across the width of the screen, I am trying to set a repeating background for the svg. I've tried setting an id, using <defs> and fill"url:e.c.t." but I can't manage to fill the image with a repeating background across the whole screen.

Any support would be much appriciated!

Thanks, Adam

1 Answer

Hi Adam, have you tried setting background-repeat: repeat in your css??

Hi Grace,

Yes I have, it changes the entire block to the texture I am after but I'm only after the shape to have a background.

Thanks,

Adam