HTML Cell Alignment with nested Table

Hello Experts, I am hoping you can help with my dilemma. I have an HTML page that has two tables one table nested to the other. What I need to do is align the cell width of the second table to match with the first one. I have tried everything to get it to work with no success. Any help would be most appreciated.


<!DOCTYPE html>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=10">
  <meta name="viewport" content="width=device-width, initial-scale=1">

      /* Create two equal columns that floats next to each other */
      .middle {
            width: 900px;
            padding: 10px;
            border: solid;
            margin-left: auto;
            margin-right: auto;

<body  bgcolor = "#86888c" text="Black">
 <div class="middle" style="background-color:#3399ff;" >
            <b><center><font size="3">
            Testing <br>
            <font size="2" color = "Red">Version 5.0 - Development</font>

      <table  border="1"  id="content"  style="width:100%" >
                  <td style="padding-left: 10px" style="font-size: 12pt">Number:</td>
                  <td style="padding-left: 10px" style="font-size: 12pt">
                  <input type="text" style="width:150px;" name = "RequestNum" size="20" title="" id="RequestNum" disabled/><i><font size="2">
                  <td style="padding-left: 10px" style="font-size: 12pt">Title:</td>
                  <td><input type="text" style="width:200px;"  id="DocTitle" name = "DocTitle" title="" color="black" rows="2" cols="50" maxlength="30" style="width:150px;">

                  <td style="padding-left: 10px" style="font-size: 12pt">Doc Number:</td>
                  <td style="padding-left: 10px" style="font-size: 12pt"><input type="text" class="doc" style="width:150px;" id="docNum0"/></td>
                  <td style="padding-left: 10px" style="font-size: 12pt" >Doc Rev: </td>
                  <td><input type="text" class="rev" style="width:40px;" id="rev0"> <input type="button" id="more_fields" onclick="add_fields();" value="+" /></td>

      <table border="1" style="width:100%">
                  <td style="padding-left: 10px">Program:</td>
                  <td style="padding-left: 10px">
                        <Select name="Program" title="" style="width:150px;" id="Program">
                        <option value="" selected>- Select -</option>
                        <option value="Test1">Stress</option>
                        <option value="Test2">Test</option>
                  <td style="padding-left: 10px">Creation Date:</td>
                        <input type ="CrDateCalc" name= "CrDateCalc" id="CrDateCalc" size="20" style="width:150px;" title="" readonly/>
                  <td colspan="100%">
                  <td colspan="2" style="font-size: 12pt"/>Testing Together:
                        <Select id="" name="" title="">
                              <option value="No">No</option>
                              <option value="Yes">Yes</option>
Eduardo AvilesAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brandon LyonSenior Frontend DeveloperCommented:
Table columns (TD) adjust to the width of the contents. If you need them to be a set width then the width needs to be defined explicitly. (can be done with css, doesn't need to be inline)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Zakaria AcharkiAnalyst DeveloperCommented:
Hi Eduardo,

Basically, it's not a good idea to it this way.

Else you need to set the same width for the TD's of both tables using classes or direct style, IMO using the percent % width will be more efficient in this case.

Working live fiddle

First don't place a form in table this is not a good practice, use DIV instead.
Also don't use inline CSS this is not a good practice, use external .css file with class.

You will see this is simpler to work and adapt the CSS and you will have uptodate code (not old fashion)...
Zakaria AcharkiAnalyst DeveloperCommented:
First don't place a form in table this is not a good practice, use DIV instead

A form is not allowed to be a child element of a table or tbody or tr.

In fact, I can't see any form inside the posted HTML, the current structure is valid and if the author wants a form then he can use it around the entire table that will not affect the correctness of the code.

You can have an entire table inside a form and you can have a form inside a table cell but you cannot have part of a table inside a form.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.