cagkebabi Posted June 4 Share Posted June 4 If I select the li element in the tween css selection in forEach, I have no problems, but when I select the a element in li, I have problems. Can you support me in this regard? I solved the problem by applying color inherit for a, but I wonder the cause of the problem See the Pen OJYmzxg by CagKebabi (@CagKebabi) on CodePen Link to comment Share on other sites More sharing options...
Solution mvaneijgen Posted June 4 Solution Share Posted June 4 Hi @cagkebabi welcome to the forum! That is correct. when you use :nth-child() selectors they all need to be children on the same level. Where your <li> elements are all children of the ul.navs your <a> elements are children of your <li>, and if you could how many children there are in your <li> it will only ever be one. This has nothing to do with GSAP, but is how CSS works. You can however use the same :nth-child() selector, but then select the <a> inside that. Still just CSS and nothing special in GSAP. Hope it helps and happy tweening! See the Pen pomPpaO?editors=1010 by mvaneijgen (@mvaneijgen) on CodePen Link to comment Share on other sites More sharing options...
cagkebabi Posted June 4 Author Share Posted June 4 Sometimes i get confused about css selectors 😅 . Thank you for your answer Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now