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

288
Views
How to determinate the width value based on the font size and a box size?

My codes in Vue, creates a tree where each node looks like:

enter image description here

As you can see, it's creates those dots at the end because I use white-space: nowrap;. I pass the component the whole data from the parent component. I want to be able to add a field which represents the maximum number of chars in all nodes (for example if one have name of "abc" and other have "abcd" so it will pass the value 4). I want to set the length of all the nodes, based on that value. The font size is 12px and the block CSS looks like:

.orgchart .node .title {
    transform: rotate(-90deg) translate(-40px, -40px) rotateY(180deg);
    transform-origin: bottom center;
    width: 120px;
}

As you can see, it's currently 120px. How can I replace this value with a calculated value? In other words, given the maximum value, how can I calculate width?

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!