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

140
Views
How to wrap multiple div without changing inner div posittion

So I'm having this issue, I'm coding a basic website using NextJS, this is an example of my code

I have a set of div like this with relative positioning

<div>one</div>
<div>two</div>
<div>three</div>

output it looks something like this

one two three

Now I want to wrap all 3 divs inside another div with absolute positioning so I can change its position freely across the screen

<div>
  <div>one</div>
  <div>two</div>
  <div>three</div>
</div>

But doing that will change inner div layout to this

one
two
three

So basically, how do I wrap multiple divs inside another div without changing inner div position?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Try this in your CSS code for the inner divs:

display: inline-block;

and this for the outer div:

width: fit-content;

See this jsfiddle demonstration

about 4 years ago · Juan Pablo Isaza Report

0

Something like this:

.parent{
  position: absolute;
  bottom: 0px;
}

.child{
  display: inline-block
}
<div class="parent">
  <div class="child">One</div>
  <div class="child">Two</div>
  <div class="child">Three</div>
</div>

about 4 years ago · Juan Pablo Isaza Report
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!