1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

How do I change a column width

Discussion in 'Web Design & Development' started by cearlp, Oct 3, 2008.

Thread Status:
Not open for further replies.
Advertisement
  1. cearlp

    cearlp Thread Starter

    Joined:
    Sep 25, 2008
    Messages:
    15
    The data displayed in a column of a table is truncated although the width of the column is defined to be wider than the data. How can I change the width of the display ?
    Attached is the table definition and a screen shot of what is displayed:

    <center>
    <table width=65% border="0">
    <tr>
    <td> </td>
    <td style="font-size:20px; font-weight:bold;"><?php echo $title?></td>
    <input type="hidden" value="<?php echo $id?>" name="memberid">
    </tr>
    <tr>
    <td> </td>
    <td> </td>
    </tr>
    <tr>
    <td align="right">First Name: </td>
    <td><input name="first_name" type="text" value="<?php echo $first_name?>"> </td>
    </tr>
    <tr>
    <td align="right">Last Name: </td>
    <td><input name="last_name" type="text" value="<?php echo $last_name?>"> </td>
    </tr>
    <tr>
    <td align="right">First Year: </td>
    <td><input name="first_yr" type="text" value="<?php echo $first_yr?>"> </td>
    </tr>
    <tr>
    <td align="right">Last Year: </td>
    <td><input name="last_yr" type="text" value="<?php echo $last_yr?>"> </td>
    </tr>
    <tr>
    <td align="right">Address: </td>
    <td><input name="address" type="text" value="<?php echo $address?>"> </td>
    </tr>
    </table>
    </center>
     

    Attached Files:

  2. amanxman

    amanxman

    Joined:
    Mar 28, 2006
    Messages:
    690
    Not sure exactly what you're after, but you can define widths of columns (<td>) like so:

    <td width="100">Blaablaa</td>

    And you can also set the table width to be a fixed px rather than %, as so:

    <table width="500">

    Just make sure that the combined total of the <td> widths across one row matches the total table width.

    Hope that helps
    amx
     
  3. cearlp

    cearlp Thread Starter

    Joined:
    Sep 25, 2008
    Messages:
    15
    amanxman,
    I already tried making the table width in pixels, and I tried your suggestion of giving the rows a width parameter also, but the result is the same. No matter what widths I try the second column has a box around the <input> field and it truncates the data that is displayed in it. As I stated in my first post, the columns seem to be wide enough, it is only the box outline around the input fields that remain the same size no matter what I set the widths to. I had hoped the partial screen shot of the displayed form would show the end result.
     
  4. amanxman

    amanxman

    Joined:
    Mar 28, 2006
    Messages:
    690
    Ah so you mean you want to change the width of the <input> fields.

    If you are using css, you can define the width of the input field pretty easily and exact px values using:

    input
    {
    width: 300px;
    }

    If you're not using css, define the width/size of each input like this:

    <input type="text" size="20" />

    The 'size' defines the length of the field in characters (not px), so play around with it until it matches whatever length you're after.

    Is that what you're after?

    amx
     
  5. cearlp

    cearlp Thread Starter

    Joined:
    Sep 25, 2008
    Messages:
    15
    Yes amanxman, that is exactly what I wanted. After searching around for html tutorials I finally found out just what you posted. Thanks for all your time and advice. The css info is interesting and something I will have to look into.
     
  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Similar Threads - change column width
  1. shakemyhead
    Replies:
    2
    Views:
    633
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/755792

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice