Jump to content
Search Community

SplitText: <br> tags and spaces (part 2)

pakl test
Moderator Tag

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 stumbled upon another oddity when using splittext on a text with line breaks:

<div class="test1">This results <br>in six words.</div>

results in six words and one linebreak.

<div class="test2">This results  <br>in seven words.</div>

results in seven words (one of which is empty) and what looks like two linebreaks. The difference between test1 and test2 is that the second one has two spaces before the linebreak.


Since a space is normally not treated as a word, this seems like a bug to me. Multiple spaces should be treated the same as a single space.



Demo here:



See the Pen wFkbL by patrickklug (@patrickklug) on CodePen

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.
  • Create New...