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 trial
varhaug
1,306 PointsCSS parallax perspective scrolling
I've been playing around with doing a Firewatch inspired CSS parallax page with some old background art I did.
http://codepen.io/countduckula/pen/jrPNgd
Only I'm running into problems mostly caused by me not using CSS since the last century.
In Chrome, Safari but not Firefox the page keeps scrolling past the end of
parallax__coverand you can see the animation layers underbits... very embarrassing.In all browsers elements placed further away are being shifted slightly in the x-axis, (Zoom out on the page to see alignment edges) I've noticed this in other peoples parallax examples as well.
I've attempted to fudge this by eyeballing the positioning on each layer eg:left: -0.45%;
Could this be caused by the illustrations being a weird size? Or maybe some weird decimalisation percentage?
basic CSS questions
I understand that by using absolute positioning
.parallax {height: 100vh; overflow-y: auto;}
I can get rid of the dreaded double scrollbars, but absolutely positioning everything back into the page feels like I'm doing something very wrong (see header/parallax__cover). Should I be applying the effect to the body tag, then putting everything in that?The margins are up to something very odd.
For example: If I use normalize.css but don't set
* {margin: 0; padding: 0;}
there ends up being a gap betweenparallax__coverand the bottom of the viewport.
Also paragraphs have a bottom margin that's extending beyond their containing div.
Is this why-vertical-margins-collapse or do I need to get reading onbox-sizing: border-box?
Any help here at all is much appreciated.
1 Answer
john larson
16,594 PointsI get it that it's not where you want it yet but I have to say...that is way cool.

varhaug
1,306 Pointsvarhaug
1,306 PointsCheers! My GF is just complaining it doesn't work on mobile...
If you haven't seen it check out the Firewatch site that I got the idea from, the illustrations by Olly Moss are amazing