Mawg
Mawg

Reputation: 40140

Table cell too wide

Please, either look at http://jsfiddle.net/mawg/pL9kd/ or stick the code below into your favourite HTML editor ...

Look to the right of OMG! Item 4 contains a *nested* array. (How) can I get that nested array (xyz) to be 2 columns wide, even if its content doesn't need so much space?

<table border="1" cellpsacing="0" cellpadding="0" style="">
  <tr><th style="border-width:1" colspan="3">This is an array</th></tr>

    <td colspan="2">
      <table border="1">
        <tr><td colspan="3">Array</td></tr>
        <tr>
          <td>item 1</td>
          <td>string ( 3 chars)</td>
          <td>abc</td>
        </tr>

        <tr>
          <td>0</td>
          <td>string ( 25 chars)</td>
          <td>item 2 is indexed by zer0</td>
        </tr>

        <tr>
          <td>this equals seven</td>
          <td>integer</td>
          <td>7</td>
        </tr>

        <tr>
          <td>item 4 is a nested array</td>

          <td colspan="2">
            <table border="1">
              <tr><td colspan="3">Array</td></tr>
              <tr>
                <td>0</td>
                <td>string ( 24 chars)</td>
                <td>item 4, offest 0's value</td>

              </tr>

              <tr>
                <td>OMG! Item 4 contains a *nested* array F5</td>
                <td colspan="2">
                  <table border="1">
                    <tr><td colspan="3">Array</td></tr>
                    <tr>

                      <td>xyz</td>
                      <td>string ( 7 chars)</td>
                      <td>xyz val</td>
                    </tr>

                  </table>
                </td>
              </tr>

              <tr>
                <td>item 4, offest 2 is True</td>
                <td>boolean</td>
                <td>True</td>
              </tr>

            </table>

          </td>
        </tr>

        <tr>
          <td>final item</td>
          <td colspan="2">NULL</td>
        </tr>

      </table>

    </td>
</table>

Upvotes: 0

Views: 1253

Answers (3)

Steve Wellens
Steve Wellens

Reputation: 20620

Do you mean like this? http://jsfiddle.net/pL9kd/8/

(Width = 100%)

Upvotes: 2

Nathaniel Wendt
Nathaniel Wendt

Reputation: 1204

From what I could find there is nothing like what your asking (or at least my interpretation of it). Could you not simply create a column width equaling two total columns?

So something like

<td width="40">xyz</td>

I could be way off but that's just my guess. Just curious, what is the implementation for this? I am sure you know css lists and other css elements are much more efficient at styling, correct?

Upvotes: 0

Suroot
Suroot

Reputation: 4423

Check this you can use the width, to set to width='66%' which works since you know there are 3 columns and 2/3 is 66%. Also set the containing table to width='100%' since you are going to need all of the possible space.

Upvotes: 0

Related Questions