Jump to content
Search Community

How to get my coloured block to animate in first then text

heavylifting test
Moderator Tag

Recommended Posts

As part of the animation below I'm using GSAP cssRule to animate the coloured pseudo element/block across the screen. However because it's tied to the text block I can't get the block to appear first and then revel the text underneath.

(Reason for using cssRule and the pseudo block is that I want to keep my HTML as semantic as possible and not crowd it with unnecessary divs.)

Thanks

See the Pen LYQJwKQ by heavymessing (@heavymessing) on CodePen

Link to comment
Share on other sites

I believe that pseudo-elements are effectively child elements when it comes to styles. You approach would therefore be impossible without some seriously hacky methods. You are much better off adding a div. I guarantee it will be less cluttered than the voodoo that would be required for the effect you are looking for.

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