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

155
Views
How to retrieve rendered padding value

I have a element with padding-right: 0.25em; and font-size: 2.75em;, this element is inside its parent node. the parent node has this style : font-size: 20px.

So the actual padding of the element is controlled by font size of the parent node right?

I may change my parent node font size to have different padding right value, How can I dynamically retrieve the real rendered value of the new padding-right?

I tried :

$('.word').innerWidth() - $('.word').width()

But this bring only the fixed value!!! in my case 12..

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

0

Use getComputedStyle as following:

let para = document.querySelector('.word');
let compStyles = window.getComputedStyle(para);

let mypadding = compStyles.getPropertyValue('padding-right');
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!