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

68
Views
working with percentages in js to set a style

I have some JavaScript code that moves a style and I need it to set the margin top with a percentage with JavaScript to move a div with the += but it uses pixels and I need it to be the same across screens eg. screen size. how can I do that with JavaScript ill give my code below the other stuff that isn't needed isn't shown;


    cowY += 10;
    cow.style.marginTop = "0%";
   cow.style.marginTop = cowY;
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

cow.style.marginTop = `${cowY}%` 

maybe?

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!