Keeping width of two tables same












2















Here I have 2 tables, I want these 2 tables' width to be same, when the Confirmer name is long the second table expands but the first one remains same, I want both of them to be of same width in any situation, how can that be done? Check this JS Bin example.



HTML:



<table>
<tbody><thead><tr><th>1.5 - STATE</th>
</tr></thead><tr>
<td>
<b>Issued by </b>User Administrator <b>on</b><font face="verdana" size="1" color="red"> 24/05/2013 06:43
</font></td>
</tr>
</tbody></table>

<table>
<tbody><tr>
<th>
Confirmer
</th>
<th>Status</th>
<th>Date</th>
<th>Comment</th>
</tr>

<tr>
<td>Pathak Chankey</td>
<td>
<img src="xyz.png">
</td>
<td> 24/05/2013 06:43 </td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Lastname Firstname</td>
<td>
<img src="xyz.png">
</td>
<td> 24/05/2013 06:43 </td>
<td>&nbsp;</td>
</tr>
<tr>
<td>User Administrator</td>
<td>
<img src="xyz.png">
</td>
<td> 24/05/2013 06:43 </td>
<td>&nbsp;</td>
</tr>
</tbody></table>


CSS:



thead{
background-color: grey;
}


table, td
{
background:#fffAF0;
border: 1px solid black;
border-collapse:collapse;
}









share|improve this question





























    2















    Here I have 2 tables, I want these 2 tables' width to be same, when the Confirmer name is long the second table expands but the first one remains same, I want both of them to be of same width in any situation, how can that be done? Check this JS Bin example.



    HTML:



    <table>
    <tbody><thead><tr><th>1.5 - STATE</th>
    </tr></thead><tr>
    <td>
    <b>Issued by </b>User Administrator <b>on</b><font face="verdana" size="1" color="red"> 24/05/2013 06:43
    </font></td>
    </tr>
    </tbody></table>

    <table>
    <tbody><tr>
    <th>
    Confirmer
    </th>
    <th>Status</th>
    <th>Date</th>
    <th>Comment</th>
    </tr>

    <tr>
    <td>Pathak Chankey</td>
    <td>
    <img src="xyz.png">
    </td>
    <td> 24/05/2013 06:43 </td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td>Lastname Firstname</td>
    <td>
    <img src="xyz.png">
    </td>
    <td> 24/05/2013 06:43 </td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td>User Administrator</td>
    <td>
    <img src="xyz.png">
    </td>
    <td> 24/05/2013 06:43 </td>
    <td>&nbsp;</td>
    </tr>
    </tbody></table>


    CSS:



    thead{
    background-color: grey;
    }


    table, td
    {
    background:#fffAF0;
    border: 1px solid black;
    border-collapse:collapse;
    }









    share|improve this question



























      2












      2








      2








      Here I have 2 tables, I want these 2 tables' width to be same, when the Confirmer name is long the second table expands but the first one remains same, I want both of them to be of same width in any situation, how can that be done? Check this JS Bin example.



      HTML:



      <table>
      <tbody><thead><tr><th>1.5 - STATE</th>
      </tr></thead><tr>
      <td>
      <b>Issued by </b>User Administrator <b>on</b><font face="verdana" size="1" color="red"> 24/05/2013 06:43
      </font></td>
      </tr>
      </tbody></table>

      <table>
      <tbody><tr>
      <th>
      Confirmer
      </th>
      <th>Status</th>
      <th>Date</th>
      <th>Comment</th>
      </tr>

      <tr>
      <td>Pathak Chankey</td>
      <td>
      <img src="xyz.png">
      </td>
      <td> 24/05/2013 06:43 </td>
      <td>&nbsp;</td>
      </tr>
      <tr>
      <td>Lastname Firstname</td>
      <td>
      <img src="xyz.png">
      </td>
      <td> 24/05/2013 06:43 </td>
      <td>&nbsp;</td>
      </tr>
      <tr>
      <td>User Administrator</td>
      <td>
      <img src="xyz.png">
      </td>
      <td> 24/05/2013 06:43 </td>
      <td>&nbsp;</td>
      </tr>
      </tbody></table>


      CSS:



      thead{
      background-color: grey;
      }


      table, td
      {
      background:#fffAF0;
      border: 1px solid black;
      border-collapse:collapse;
      }









      share|improve this question
















      Here I have 2 tables, I want these 2 tables' width to be same, when the Confirmer name is long the second table expands but the first one remains same, I want both of them to be of same width in any situation, how can that be done? Check this JS Bin example.



      HTML:



      <table>
      <tbody><thead><tr><th>1.5 - STATE</th>
      </tr></thead><tr>
      <td>
      <b>Issued by </b>User Administrator <b>on</b><font face="verdana" size="1" color="red"> 24/05/2013 06:43
      </font></td>
      </tr>
      </tbody></table>

      <table>
      <tbody><tr>
      <th>
      Confirmer
      </th>
      <th>Status</th>
      <th>Date</th>
      <th>Comment</th>
      </tr>

      <tr>
      <td>Pathak Chankey</td>
      <td>
      <img src="xyz.png">
      </td>
      <td> 24/05/2013 06:43 </td>
      <td>&nbsp;</td>
      </tr>
      <tr>
      <td>Lastname Firstname</td>
      <td>
      <img src="xyz.png">
      </td>
      <td> 24/05/2013 06:43 </td>
      <td>&nbsp;</td>
      </tr>
      <tr>
      <td>User Administrator</td>
      <td>
      <img src="xyz.png">
      </td>
      <td> 24/05/2013 06:43 </td>
      <td>&nbsp;</td>
      </tr>
      </tbody></table>


      CSS:



      thead{
      background-color: grey;
      }


      table, td
      {
      background:#fffAF0;
      border: 1px solid black;
      border-collapse:collapse;
      }






      html css html-table






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 22 '18 at 15:48









      Brian Tompsett - 汤莱恩

      4,2131338101




      4,2131338101










      asked May 27 '13 at 5:18









      Chankey PathakChankey Pathak

      14.9k952103




      14.9k952103
























          2 Answers
          2






          active

          oldest

          votes


















          3














          Just add a container and set a width in your container then apply the 100% width to your tables like this



          div{

          width:400px;
          }

          table {

          width:100%;
          }

          <div>
          <table></table>
          <table></table>
          </div>


          http://jsbin.com/iduciw/32/edit






          share|improve this answer































            1














            Why do not you use a single table?



            <table>
            <tr>
            <th colspan="4">1.5 - STATE</th>
            </tr>
            <tr>
            <td colspan="4"><b>Issued by </b>User Administrator <b>on</b><font face="verdana" size="1" color="red"> 24/05/2013 06:43 </font></td>
            </tr>
            <tr>
            <th> Confirmer </th>
            <th>Status</th>
            <th>Date</th>
            <th>Comment</th>
            </tr>
            <tr>
            <td>Pathak Chankey</td>
            <td><img src="xyz.png"></td>
            <td> 24/05/2013 06:43 </td>
            <td>&nbsp;</td>
            </tr>
            <tr>
            <td>Lastname Firstname</td>
            <td><img src="xyz.png"></td>
            <td> 24/05/2013 06:43 </td>
            <td>&nbsp;</td>
            </tr>
            <tr>
            <td>User Administrator</td>
            <td><img src="xyz.png"></td>
            <td> 24/05/2013 06:43 </td>
            <td>&nbsp;</td>
            </tr>
            </table>





            share|improve this answer

























              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f16766696%2fkeeping-width-of-two-tables-same%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              3














              Just add a container and set a width in your container then apply the 100% width to your tables like this



              div{

              width:400px;
              }

              table {

              width:100%;
              }

              <div>
              <table></table>
              <table></table>
              </div>


              http://jsbin.com/iduciw/32/edit






              share|improve this answer




























                3














                Just add a container and set a width in your container then apply the 100% width to your tables like this



                div{

                width:400px;
                }

                table {

                width:100%;
                }

                <div>
                <table></table>
                <table></table>
                </div>


                http://jsbin.com/iduciw/32/edit






                share|improve this answer


























                  3












                  3








                  3







                  Just add a container and set a width in your container then apply the 100% width to your tables like this



                  div{

                  width:400px;
                  }

                  table {

                  width:100%;
                  }

                  <div>
                  <table></table>
                  <table></table>
                  </div>


                  http://jsbin.com/iduciw/32/edit






                  share|improve this answer













                  Just add a container and set a width in your container then apply the 100% width to your tables like this



                  div{

                  width:400px;
                  }

                  table {

                  width:100%;
                  }

                  <div>
                  <table></table>
                  <table></table>
                  </div>


                  http://jsbin.com/iduciw/32/edit







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered May 27 '13 at 5:27









                  JorgeJorge

                  10.7k1469112




                  10.7k1469112

























                      1














                      Why do not you use a single table?



                      <table>
                      <tr>
                      <th colspan="4">1.5 - STATE</th>
                      </tr>
                      <tr>
                      <td colspan="4"><b>Issued by </b>User Administrator <b>on</b><font face="verdana" size="1" color="red"> 24/05/2013 06:43 </font></td>
                      </tr>
                      <tr>
                      <th> Confirmer </th>
                      <th>Status</th>
                      <th>Date</th>
                      <th>Comment</th>
                      </tr>
                      <tr>
                      <td>Pathak Chankey</td>
                      <td><img src="xyz.png"></td>
                      <td> 24/05/2013 06:43 </td>
                      <td>&nbsp;</td>
                      </tr>
                      <tr>
                      <td>Lastname Firstname</td>
                      <td><img src="xyz.png"></td>
                      <td> 24/05/2013 06:43 </td>
                      <td>&nbsp;</td>
                      </tr>
                      <tr>
                      <td>User Administrator</td>
                      <td><img src="xyz.png"></td>
                      <td> 24/05/2013 06:43 </td>
                      <td>&nbsp;</td>
                      </tr>
                      </table>





                      share|improve this answer






























                        1














                        Why do not you use a single table?



                        <table>
                        <tr>
                        <th colspan="4">1.5 - STATE</th>
                        </tr>
                        <tr>
                        <td colspan="4"><b>Issued by </b>User Administrator <b>on</b><font face="verdana" size="1" color="red"> 24/05/2013 06:43 </font></td>
                        </tr>
                        <tr>
                        <th> Confirmer </th>
                        <th>Status</th>
                        <th>Date</th>
                        <th>Comment</th>
                        </tr>
                        <tr>
                        <td>Pathak Chankey</td>
                        <td><img src="xyz.png"></td>
                        <td> 24/05/2013 06:43 </td>
                        <td>&nbsp;</td>
                        </tr>
                        <tr>
                        <td>Lastname Firstname</td>
                        <td><img src="xyz.png"></td>
                        <td> 24/05/2013 06:43 </td>
                        <td>&nbsp;</td>
                        </tr>
                        <tr>
                        <td>User Administrator</td>
                        <td><img src="xyz.png"></td>
                        <td> 24/05/2013 06:43 </td>
                        <td>&nbsp;</td>
                        </tr>
                        </table>





                        share|improve this answer




























                          1












                          1








                          1







                          Why do not you use a single table?



                          <table>
                          <tr>
                          <th colspan="4">1.5 - STATE</th>
                          </tr>
                          <tr>
                          <td colspan="4"><b>Issued by </b>User Administrator <b>on</b><font face="verdana" size="1" color="red"> 24/05/2013 06:43 </font></td>
                          </tr>
                          <tr>
                          <th> Confirmer </th>
                          <th>Status</th>
                          <th>Date</th>
                          <th>Comment</th>
                          </tr>
                          <tr>
                          <td>Pathak Chankey</td>
                          <td><img src="xyz.png"></td>
                          <td> 24/05/2013 06:43 </td>
                          <td>&nbsp;</td>
                          </tr>
                          <tr>
                          <td>Lastname Firstname</td>
                          <td><img src="xyz.png"></td>
                          <td> 24/05/2013 06:43 </td>
                          <td>&nbsp;</td>
                          </tr>
                          <tr>
                          <td>User Administrator</td>
                          <td><img src="xyz.png"></td>
                          <td> 24/05/2013 06:43 </td>
                          <td>&nbsp;</td>
                          </tr>
                          </table>





                          share|improve this answer















                          Why do not you use a single table?



                          <table>
                          <tr>
                          <th colspan="4">1.5 - STATE</th>
                          </tr>
                          <tr>
                          <td colspan="4"><b>Issued by </b>User Administrator <b>on</b><font face="verdana" size="1" color="red"> 24/05/2013 06:43 </font></td>
                          </tr>
                          <tr>
                          <th> Confirmer </th>
                          <th>Status</th>
                          <th>Date</th>
                          <th>Comment</th>
                          </tr>
                          <tr>
                          <td>Pathak Chankey</td>
                          <td><img src="xyz.png"></td>
                          <td> 24/05/2013 06:43 </td>
                          <td>&nbsp;</td>
                          </tr>
                          <tr>
                          <td>Lastname Firstname</td>
                          <td><img src="xyz.png"></td>
                          <td> 24/05/2013 06:43 </td>
                          <td>&nbsp;</td>
                          </tr>
                          <tr>
                          <td>User Administrator</td>
                          <td><img src="xyz.png"></td>
                          <td> 24/05/2013 06:43 </td>
                          <td>&nbsp;</td>
                          </tr>
                          </table>






                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited May 27 '13 at 5:30

























                          answered May 27 '13 at 5:25









                          zkanocazkanoca

                          5,50053774




                          5,50053774






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f16766696%2fkeeping-width-of-two-tables-same%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Ottavio Pratesi

                              Tricia Helfer

                              15 giugno