
web developer @freecodecampES translator
- Tweets450
- Following182
- Followers11
- Likes4.2K

ALT /* the structure for the basic paralax effect: * .parent * .child.back * .child.front-clip */ /* ❌ DON'T 😭 */ .parent { position: relative } .child.back { position: absolute; /* look, if you're going to do this, * it's better to use inset: 0 instead * of the next 4 declarations */ top: 0; left: 0; width: 100%; height: 100% } .child.front-clip { position: absolute; top: 50%; left: 50%; /* at least simplify this with translate: -50% -50% */ transform: translate(-50%, -50%); /* you don't need z-index when you have the transform * please learn how the stacking context works */ z-index: 999 }

ALT /* the structure for the basic paralax effect: * .parent * .child.back * .child.front-clip */ /* ✅ DO 😻 (just 3 CSS declarations!) */ .parent { display: grid } /* place all `.child` elements in the grid cell * on the 1st grid row & on the 1st grid column */ .child { grid-area: 1/ 1 } /* by default, a grid item stretches * to cover its entire grid cell * `place-self: center` puts it * in the middle along both axes*/ .front-clip { place-self: center }


















