Pricing Blog

Match Table Column Size to that of header

  • _.__._.__.__._-1406596950660354052

    Ethan

    11 days ago

    Hi all,

    I'm creating a generic table component that takes in JSON and builds the table from that using repeated elements. All has gone well so far but I can't figure out how to set the size of the <td> elements in each row to the size of their header element, so that they align properly. How should I achieve this?
    1406596951599743007-image.png
    1
  • _.__._.__.__._-1406636099677327470

    Ethan

    11 days ago

    The answer was the use a style variable and an attribute on the component
  • lucasg-1406660835241103552

    Lucas G

    11 days ago

    You generally only need to set the body cell width and the header cells automatically adapt
  • As long as you’re using all the appropriate table elements
  • _.__._.__.__._-1406883285975699517

    Ethan

    10 days ago

    I was using <table> <thead> <tbody> <tr> <th> and <td>
  • _.__._.__.__._-1406883619871527045

    Ethan

    10 days ago

    I had everything pretty much using the default setting, except for the row direction, since it was stacking cells vertically not horizontally
  • Tod-1406883622824443956

    Tod

    10 days ago

    Great job @Ethan! Your contribution to the Nordcraft Community just made you advance to Community Level 2! 🌲
  • lucasg-1406998104355635261

    Lucas G

    10 days ago

    Then you should only need to set a width on the body cells. That’s how I do it at least
  • filip_dajkovic-1407296409140727888

    Filip Dajkovic

    9 days ago

    I think you may be missing appropriate display properties for all of those table elements. You can reference this post to get it right: https://discord.com/channels/972416966683926538/1387467517894590544