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

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,135 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

http://stackoverflow.com/questions/1191464/is-there-a-way-to-use-use-text-as-the-background-with-css

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