Jump to content
Search Community

Divs not matching animation matrix

kathryn.crawford test
Moderator Tag

Go to solution Solved by kathryn.crawford,

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

Hello kathryn.crawford,

 

Be careful about depending on text-align center to fix this issue from your original codpen cross browser. Since text-align: center is calculated differently in each browser.

 

Better to just add in your CSS top:0; and left:0; on #banner, img, #donate, #frame1, and #frame2.. that use position: absolute.

 

See the Pen wKRQYN by jonathan (@jonathan) on CodePen

 

According to the CSS spec for top, bottom, right, and left. Their initial value is auto. So it is always best practice to set them to zero (0) if filling your parent element.

 

As a rule of thumb, anytime you use position absolute or position fixed. You must declare your top or bottom and your left or right CSS property. And don't forget to add position relative to your parent #ad div. So this way your absolutely positioned children will be absolutely positioned relative to their parent (#ad).

 

You basically first set up your scene:

  • By setting position relative on your parent div #ad
  • Then on the #ad div's children you use position absolute along with top or bottom and left or right CSS properties.
  • Then you animate with GSAP using CSS transforms x, y, and z
Once you setup your scene this way, animating is much more easy and fun

 

;)

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