Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

90
Views
Animate the position of elements together in a single wrapper or every element separately?

The layout of my simple website is that there are 3 sections below each other with different background and every section have it's own textual content. I want to achieve so called 3D perspective effect, that the content text will throw shadow over the background section and when scrolling, the text will scroll a little bit faster than background.

Now there are thow ways of organizing the code:

First - every section (with background) have it's own content:

<main>
  <section class="background-1">
    <div class="content-1">Some text and image</div>
  </section>
  <section class="background-2">
    <div class="content-2">Some text and image</div>
  </section>
  <section class="background-3">
    <div class="content-3">Some text and image</div>
  </section>
</main>

Second - sections (serving as a background) and text contents (hovering over background) are separated:

<div class="backgrounds">
  <div class="background-1"></div>
  <div class="background-2"></div>
  <div class="background-3"></div>
</div>
<main class="contents">
  <section class="content-1">Some text and image</section>
  <section class="content-2">Some text and image</section>
  <section class="content-3">Some text and image</section>
</main>

The difference is, that in first case, we must animate let's say top property of every content separately and in second case only the .contents wrapper need to be animated.

What is more preferred way, especially considering mobile device performance, then SEO and other stuff?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!