Jump to content
GreenSock

geddski

SplitText dropping indents/formatting

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I'm needing to display formatted code with SplitText. Currently it strips out all my spaces. I've tried things like adding a bunch of " " but those get removed as well. I tried the pre tag but no luck either. How do I make it honor spaces/formatting like the docs say it's supposed to? (Note: I also have to add br tags any time I want line breaks, assuming its the same problem)

See the Pen VyaGRO by geddski (@geddski) on CodePen

Link to comment
Share on other sites

Hi @geddski  :)

 

At first, for the Club GreenSock bonus plugins on Codepen; you can find the codepen safe versions here: 

See the Pen OPqpRJ by GreenSock (@GreenSock) on CodePen

 

 

And about your issue; pls try to wrap your spacing entities with a span tag. <span>&nbsp;&nbsp;.....</span> 

 

Splittext completely respects to <br> tags.

 

btw, you can use "&emsp;" instead of "&nbsp;"

  • Like 6
Link to comment
Share on other sites

Ahh the span wrapper worked, thank you! I updated the pen with the safe version, will keep it around for anyone else who runs into this. Thanks again!

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×