Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
niiku23

Split text line widths

Recommended Posts

Hi,

 

Hoping somebody can help me with this please.

 

Codepen is here.

 

I would like the blue background colors to end at the end of each line width instead of stretching to the end of the container.

 

Using max-width: max-content;  works but not in i.e.

 

I don't really need the words split but I am wondering if i need to loop through each line and find each end words position to set the width of the line.

Surely there is a simple split text parameter to fix this?

 

Many thanks!

 

Nick

See the Pen MWOWMBE by niiku23 (@niiku23) on CodePen

Link to comment
Share on other sites

Hi @niiku23,


This is just down to your CSS (styling) not to do with GSAP.

I think you're looking for display: inline-block?

 

Good luck with your project!

  • Like 1
Link to comment
Share on other sites

Hi,

 

Thanks Cassie,

 

inline-block doesn't do it unfortunately.

 

I would like the blue to end on the actual line lengths.

 

 

Link to comment
Share on other sites

49 minutes ago, niiku23 said:

inline-block doesn't do it unfortunately.

inline-block should do work. However, SplitText lines adds display block inline, so that it avoids certain issues. You may need to use !important in your css, or set it via gsap

  • Like 1
Link to comment
Share on other sites

Also you've put inline block on the container,

 

You'll need to style the children - here's an option with !important as Ryan suggested.

See the Pen NWwPqwJ by cassie-codes (@cassie-codes) on CodePen

  • Like 1
Link to comment
Share on other sites

Amazing that is perfect.

 

Thank you both!

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.
×