Jump to content
Search Community

Splittext breaks on inline elements

TBWA-NY 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

Splittext will sometimes split lines in odd ways, leaving single words by themselves.


Has anyone else had experience with this?

I have seen other posts suggesting to add letter-spacing etc.. which may fix it at a certain container width, but it will still do it at other widths.

 

 

Are nested inline elements supported if splitting by lines?

The documentation says no, but the workaround that is suggested doesn't seem to work either.

See the Pen ZdLybq by trobie (@trobie) on CodePen

Link to comment
Share on other sites

Thank you for the replies!


The odd thing is that on the site I am developing, the split occurred in an instance where there is only one word wrapped with an inline tag.
I got it to break in the odd way once or twice with this configuration in a pen, but it would not do it reliably. (sometimes break, then not).
So I did it with two words since it would always break. 

I am going to see if I can replicate the exact issue in a pen.

Link to comment
Share on other sites

Found the issue. 

 

I was preemptively setting overflow:hidden on the generated line divs without using a specific linesClass

This must somehow effect the calculation of what text is on what lines. I updated my pen to show that.

Bug of my own making. Easy to see it doesn't occur if you disable that style.

 

Thanks again guys for taking a look.

  • Like 3
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...