Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAbe Layee
8,378 PointsAnimation won't center on the page.
Hello there. I ran into a little bug and I have been trying to figure it out where I went wrong. However, I can't find my mistake in my code. My animation supposed to be in the center of the page. Here is my codepen link http://codepen.io/Layee/pen/qdmjvy
3 Answers
Basya Rosemann
1,974 PointsHi Abe,
I think your problem is that you are absolutely positioning the h2 with class "removeMargin", and giving the value "left: 50%".
What is happening is that your h1 and h2 block's top left corner (and not the center of your h1/h2 block) is being positioned at the 50% point.
Abe Layee
8,378 PointsSo how do I fix it?
Basya Rosemann
1,974 PointsYou can give it a different value, such as "left: 35%;", instead of "left:50%".
Personally I would not absolutely position these elements at all. One reason for that is that it won't necessarily be centered on different width screens. You can find ways of centering elements on your page in this very simple article: https://css-tricks.com/centering-css-complete-guide/
Good luck!