7 Replies Latest reply: Jun 19, 2013 7:46 AM by MurraySummers RSS

    Table cell widths

    ecc_ldillon

      How do I set a specific table cell width that does not automatically adjust when content is added?

       

      For example, I have code with a table cell set to 175px wide, however when I try to split the cell below it, the cell ignores the 175px setting.

        • 1. Re: Table cell widths
          Nancy O. MVP

          How do I set a specific table cell width that does not automatically adjust when content is added?

           

          What is the total width of your Table? 

          When you save/refresh your page, the table cells should snap back into position.  Use live view or preview in browser to test your layout.  Design view isn't 100% reliable.

           

           

          Nancy O.

          • 2. Re: Table cell widths
            ecc_ldillon Community Member

            My table total width is 795 pixels.  Specifically, my issue comes when trying to have a different number of columns in each row of the table.  It seems to be ignoring the values of the width of the cells I set. Here is my code:

             

            <table width="795" border="2" cellpadding="0">

              <tr>

                <td width="175" colspan="3"> </td>

                <td width="215"> </td>

                <td width="175"> </td>

                <td width="215"> </td>

              </tr>

              <tr>

                <td colspan="3"> </td>

                <td> </td>

                <td> </td>

                <td> </td>

              </tr>

              <tr>

                <td width="132.5"> </td>

                <td width="132.5"> </td>

                <td width="132.5"> </td>

                <td width="132.5"> </td>

                <td width="132.5"> </td>

                <td width="132.5"> </td>

              </tr>

            </table>

            • 3. Re: Table cell widths
              MurraySummers ACP/MVPs

              This is the VERY wrong way to work with tables. To make things behave, you need a new table for each row. Just put one table after another (each with the desired row configuration) on the page, and they'll stack up like Legos.

              • 4. Re: Table cell widths
                mytaxsite.co.uk MVP

                Have you tried to hard-wire the widths in the table itself like this:

                 

                 

                <table style="width: 795px; border: 2px; padding: 0;">

                  <tr>

                    <td style="width: 175px;" colspan="3">  </td>

                    <td style="width: 215px;">  </td>

                    <td style="width: 175px;">  </td>

                    <td style="width: 215px;">  </td>

                  </tr>

                  <tr>

                    <td colspan="3">  </td>

                    <td>  </td>

                    <td>  </td>

                    <td>  </td>

                  </tr>

                  <tr>

                    <td style="width: 133px;"> </td>

                    <td style="width: 133px;"> </td>

                    <td style="width: 133px;"> </td>

                    <td style="width: 133px;"> </td>

                    <td style="width: 133px;"> </td>

                    <td style="width: 133px;"> </td>

                  </tr>

                </table>

                 

                You need to do the math so that total width of individual cells plus two borders does not exceed the width of the table.  Apart from that it should work though I haven't used tables for some time now. 

                 

                Of course you could use header styles to streamline the process but I just did this quickly.

                 

                I must update the RPIs and Consumer Prices Index on my site for my tax clients to refer to.

                • 5. Re: Table cell widths
                  ecc_ldillon Community Member

                  Making a new table for each row is what I ended up doing, although that was not what I wanted to do.  I know with Microsoft Word you can specify the table cells to be a set width, and no matter what you do to the row below it they do not change.  I would assume that with a highly technical software such as Adobe Dreamweaver, you could achieve the same results, however apparently I was wrong.

                  • 6. Re: Table cell widths
                    Jon Fritz II MVP

                    The problem isn't DW, HTML just doesn't work well that way.

                     

                    No matter how sophisticated our programs get, they always end up limited by what HTML can do.

                    • 7. Re: Table cell widths
                      MurraySummers ACP/MVPs

                      Actually, it's HTML tables that don't work that way. You either learn how *they* want to work, or you perish in frustration and flames!