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

391
Views
How do you resize the Divs on your page based on screen size?

I am in the middle of completing a coding test. I want to change all my div sizes according to screen size. This is because my test does not look the same on my laptop than it looks on a mac computer monitor. On my small laptop all the divs look big, however on a mac computer monitor it appears to look decent.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Use vh.

Refer Viewport sized typography

Use 100vh and 100vw if you want full width and full height. Else change accordingly.

div {
  height: 100vh;
  width:100vh
}
over 4 years ago · Santiago Trujillo Report

0

Use media queries or set width/height in % or vw/vh instead of px
I hope that is the thing you are looking for... Or maybe use framework like bootstrap or foundation

over 4 years ago · Santiago Trujillo Report

0

You should use Chrome Developer Tools to check at what resolution you want to change the size of your div!

If you have a div:

#bluebox {
width: 50px;
height: 50px;
background-color: blue;
}
<div id="bluebox">
</div>

But, when the screen size is 480px wide you only want the div to be 25px X 25px you would do like this:

#bluebox {
width: 50px;
height: 50px;
background-color: blue;
}

@media (max-width: 480px) {
  #bluebox {
    width: 25px;
    height: 25px;
  }
}
<div id="bluebox">
</div>

This is done with media queries - which is very simple and standard. I hope it helped!

over 4 years ago · Santiago Trujillo 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!