• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

122
Views
How to make cells automatcially go to a new row

I have a table that is 650px wide and I add words to this table...each word is in its own cell. However if I have too many words then it expands the table.
What I want to do is allow it to limit the X and auto go to a new row or under the current content so it doesn't resize the table.

I thought about calculating the width of each cell using JS..but it says each is 0px as the cells are created programmatically using JS.

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

0

Perhaps a table is not the best solution for you, since it doesn't have this functionality.

You could try simple <div>'s, they will wrap, but you could also have a look at the newer, and more advanced, Flexbox. Have a look at the Wrapping section on that page.

about 3 years ago · Juan Pablo Isaza Report

0

I got it work by using

 #tGrammar {
  display: block;
  }

 #tGrammar td {
  display: inline-block;
  }

in CSS

and in JS where is tChoicesMain is table

tChoicesMain.style.tableLayout = "fixed";
tChoicesMain.style.maxWidth = "650px";
tChoicesMain.setAttribute("id", "tGrammar");
about 3 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 Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error