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


repeat text?

i'm just messing around with a page, and I was trying to figure out how to set a string of text to repeat across an entire body. Can this be done with html/css, or would it be a script? absolute newbie, obviously. I did a few searches but only came up with php and I dont quite get that yet

I agree with the loop to make this happen.

That being said, why do you want the text to appear across and entire body...not criticizing just interested.

Just a whim, really. Once I wonder, "how would I do this?" then i have to figure it out

3 Answers

Kevin Korte
Kevin Korte
28,148 Points

As far as I'm aware this would have to be a JS/Jquery thing, or a server side thing like PHP. I don't think you can do it with CSS. The only way I can think of it is if you could somehow get the words as a background and repeat it with CSS. I'm not sure that is possible though without the text being an image.

Colin Marshall
Colin Marshall
32,861 Points

You would need a loop to accomplish this so you would need to use JavaScript or PHP.

Kevin/Colin - I figured from what I saw on Google - I just wasn't sure if I was missing something. Thanks!

I think you can. I found this on stackoverflow


maybe try setting background repeat and see. Hope that helps.