Different 100% height of table in Chrome/IE and FireFox












1















The problem is, that all of elements (main container, table container and table itself) must have 100% height. Table itself has slightly smaller size in Chrome and IE, than in Firefox, which causes a small gap between .table-container and table borders.



Do somebody know how to fix this? I've spent almost all day for this, and can't simply find a solution. Would be grateful for any help.



Here is a link for fiddle with my current problem: fiddle link



<div class="container">
<div class="buttons">
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<div class="table-container">
<table>
<thead>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
</thead>
<tbody>
<tr>
<td>a</td>
<td>b</td>
<td>c</td>
<td>d</td>
</tr>
<tr>
<td>aa</td>
<td>bb</td>
<td>cc</td>
<td>dd</td>
</tr>
<tr>
<td>aaa</td>
<td>bbb</td>
<td>ccc</td>
<td>ddd</td>
</tr>
</tbody>
</table>
</div>
</div>


and CSS:



html, body, .container, .table-container, table
{
height: 100%;
}

.container
{
display: block;
width: 500px;
margin: 0 auto;
text-align: center;
}

.table-container
{
width: 100%;
border: 1px solid red;
padding-top: 30px;
margin-top: -30px;
}

.buttons
{
height: 30px;
}

.buttons div
{
box-sizing: border-box;
-moz-box-sizing: border-box;
width: 25%;
float: left;
height: 30px;
border: 1px solid black;
}

table
{
border: 1px solid black;
width: 100%;
border-spacing: 0;
}

thead td, tbody td
{
width: 25%;
height: 25%;
}


Update: added padding and negative margin for .table-container
Update2: added border-spacing and border-collapse to an example. Still not working properly.
Update3: Now it works here, which means, that i couldn't fully reproduce my bug to show it to you :( But in general, the problem is, that the height of 5x5 table in Chrome is less from FF on 22px, which is 22px gap between table container and a table itself. Each cell has around 4px + to table height in Firefox.










share|improve this question





























    1















    The problem is, that all of elements (main container, table container and table itself) must have 100% height. Table itself has slightly smaller size in Chrome and IE, than in Firefox, which causes a small gap between .table-container and table borders.



    Do somebody know how to fix this? I've spent almost all day for this, and can't simply find a solution. Would be grateful for any help.



    Here is a link for fiddle with my current problem: fiddle link



    <div class="container">
    <div class="buttons">
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    </div>
    <div class="table-container">
    <table>
    <thead>
    <tr>
    <td>1</td>
    <td>2</td>
    <td>3</td>
    <td>4</td>
    </tr>
    </thead>
    <tbody>
    <tr>
    <td>a</td>
    <td>b</td>
    <td>c</td>
    <td>d</td>
    </tr>
    <tr>
    <td>aa</td>
    <td>bb</td>
    <td>cc</td>
    <td>dd</td>
    </tr>
    <tr>
    <td>aaa</td>
    <td>bbb</td>
    <td>ccc</td>
    <td>ddd</td>
    </tr>
    </tbody>
    </table>
    </div>
    </div>


    and CSS:



    html, body, .container, .table-container, table
    {
    height: 100%;
    }

    .container
    {
    display: block;
    width: 500px;
    margin: 0 auto;
    text-align: center;
    }

    .table-container
    {
    width: 100%;
    border: 1px solid red;
    padding-top: 30px;
    margin-top: -30px;
    }

    .buttons
    {
    height: 30px;
    }

    .buttons div
    {
    box-sizing: border-box;
    -moz-box-sizing: border-box;
    width: 25%;
    float: left;
    height: 30px;
    border: 1px solid black;
    }

    table
    {
    border: 1px solid black;
    width: 100%;
    border-spacing: 0;
    }

    thead td, tbody td
    {
    width: 25%;
    height: 25%;
    }


    Update: added padding and negative margin for .table-container
    Update2: added border-spacing and border-collapse to an example. Still not working properly.
    Update3: Now it works here, which means, that i couldn't fully reproduce my bug to show it to you :( But in general, the problem is, that the height of 5x5 table in Chrome is less from FF on 22px, which is 22px gap between table container and a table itself. Each cell has around 4px + to table height in Firefox.










    share|improve this question



























      1












      1








      1








      The problem is, that all of elements (main container, table container and table itself) must have 100% height. Table itself has slightly smaller size in Chrome and IE, than in Firefox, which causes a small gap between .table-container and table borders.



      Do somebody know how to fix this? I've spent almost all day for this, and can't simply find a solution. Would be grateful for any help.



      Here is a link for fiddle with my current problem: fiddle link



      <div class="container">
      <div class="buttons">
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      </div>
      <div class="table-container">
      <table>
      <thead>
      <tr>
      <td>1</td>
      <td>2</td>
      <td>3</td>
      <td>4</td>
      </tr>
      </thead>
      <tbody>
      <tr>
      <td>a</td>
      <td>b</td>
      <td>c</td>
      <td>d</td>
      </tr>
      <tr>
      <td>aa</td>
      <td>bb</td>
      <td>cc</td>
      <td>dd</td>
      </tr>
      <tr>
      <td>aaa</td>
      <td>bbb</td>
      <td>ccc</td>
      <td>ddd</td>
      </tr>
      </tbody>
      </table>
      </div>
      </div>


      and CSS:



      html, body, .container, .table-container, table
      {
      height: 100%;
      }

      .container
      {
      display: block;
      width: 500px;
      margin: 0 auto;
      text-align: center;
      }

      .table-container
      {
      width: 100%;
      border: 1px solid red;
      padding-top: 30px;
      margin-top: -30px;
      }

      .buttons
      {
      height: 30px;
      }

      .buttons div
      {
      box-sizing: border-box;
      -moz-box-sizing: border-box;
      width: 25%;
      float: left;
      height: 30px;
      border: 1px solid black;
      }

      table
      {
      border: 1px solid black;
      width: 100%;
      border-spacing: 0;
      }

      thead td, tbody td
      {
      width: 25%;
      height: 25%;
      }


      Update: added padding and negative margin for .table-container
      Update2: added border-spacing and border-collapse to an example. Still not working properly.
      Update3: Now it works here, which means, that i couldn't fully reproduce my bug to show it to you :( But in general, the problem is, that the height of 5x5 table in Chrome is less from FF on 22px, which is 22px gap between table container and a table itself. Each cell has around 4px + to table height in Firefox.










      share|improve this question
















      The problem is, that all of elements (main container, table container and table itself) must have 100% height. Table itself has slightly smaller size in Chrome and IE, than in Firefox, which causes a small gap between .table-container and table borders.



      Do somebody know how to fix this? I've spent almost all day for this, and can't simply find a solution. Would be grateful for any help.



      Here is a link for fiddle with my current problem: fiddle link



      <div class="container">
      <div class="buttons">
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      </div>
      <div class="table-container">
      <table>
      <thead>
      <tr>
      <td>1</td>
      <td>2</td>
      <td>3</td>
      <td>4</td>
      </tr>
      </thead>
      <tbody>
      <tr>
      <td>a</td>
      <td>b</td>
      <td>c</td>
      <td>d</td>
      </tr>
      <tr>
      <td>aa</td>
      <td>bb</td>
      <td>cc</td>
      <td>dd</td>
      </tr>
      <tr>
      <td>aaa</td>
      <td>bbb</td>
      <td>ccc</td>
      <td>ddd</td>
      </tr>
      </tbody>
      </table>
      </div>
      </div>


      and CSS:



      html, body, .container, .table-container, table
      {
      height: 100%;
      }

      .container
      {
      display: block;
      width: 500px;
      margin: 0 auto;
      text-align: center;
      }

      .table-container
      {
      width: 100%;
      border: 1px solid red;
      padding-top: 30px;
      margin-top: -30px;
      }

      .buttons
      {
      height: 30px;
      }

      .buttons div
      {
      box-sizing: border-box;
      -moz-box-sizing: border-box;
      width: 25%;
      float: left;
      height: 30px;
      border: 1px solid black;
      }

      table
      {
      border: 1px solid black;
      width: 100%;
      border-spacing: 0;
      }

      thead td, tbody td
      {
      width: 25%;
      height: 25%;
      }


      Update: added padding and negative margin for .table-container
      Update2: added border-spacing and border-collapse to an example. Still not working properly.
      Update3: Now it works here, which means, that i couldn't fully reproduce my bug to show it to you :( But in general, the problem is, that the height of 5x5 table in Chrome is less from FF on 22px, which is 22px gap between table container and a table itself. Each cell has around 4px + to table height in Firefox.







      html css html-table






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 '18 at 11:57









      Brian Tompsett - 汤莱恩

      4,2231338101




      4,2231338101










      asked Apr 23 '13 at 12:18









      KamiliusKamilius

      3691027




      3691027
























          2 Answers
          2






          active

          oldest

          votes


















          1














          It appears to be the border spacing on the table.



          Apply this CSS to the table element:



          border-spacing: 0;





          share|improve this answer
























          • Nope, added those two into fiddle and code here. Didn't helped

            – Kamilius
            Apr 23 '13 at 12:42






          • 3





            Border-spacing is not valid when the border-collapse is set to 'collapse' it is only used when border-collapse is set to separate!

            – Zeddy
            Apr 23 '13 at 12:43











          • @Zaf Khan +1 Good point, I didn't even notice it was set to collapse...

            – MasNotsram
            Apr 23 '13 at 12:47











          • So for THIS example, you're right, SpAm. But trouble still persists and i think that i'm forced to figure it out by myself :) Thanks btw.

            – Kamilius
            Apr 23 '13 at 12:54



















          1














          Be aware that



          width: 100%;


          does not work the exactly the same way as



          height: 100%;


          does.



          While width: 100% grabs 100% of the parent's width even if there has not been an explicit setting of that width, height: 100% works only on elements whose parents have a fixed height.



          Simply speaking, %-width applies dynamically, while %-height applies to static parents container's heights.






          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%2f16169171%2fdifferent-100-height-of-table-in-chrome-ie-and-firefox%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









            1














            It appears to be the border spacing on the table.



            Apply this CSS to the table element:



            border-spacing: 0;





            share|improve this answer
























            • Nope, added those two into fiddle and code here. Didn't helped

              – Kamilius
              Apr 23 '13 at 12:42






            • 3





              Border-spacing is not valid when the border-collapse is set to 'collapse' it is only used when border-collapse is set to separate!

              – Zeddy
              Apr 23 '13 at 12:43











            • @Zaf Khan +1 Good point, I didn't even notice it was set to collapse...

              – MasNotsram
              Apr 23 '13 at 12:47











            • So for THIS example, you're right, SpAm. But trouble still persists and i think that i'm forced to figure it out by myself :) Thanks btw.

              – Kamilius
              Apr 23 '13 at 12:54
















            1














            It appears to be the border spacing on the table.



            Apply this CSS to the table element:



            border-spacing: 0;





            share|improve this answer
























            • Nope, added those two into fiddle and code here. Didn't helped

              – Kamilius
              Apr 23 '13 at 12:42






            • 3





              Border-spacing is not valid when the border-collapse is set to 'collapse' it is only used when border-collapse is set to separate!

              – Zeddy
              Apr 23 '13 at 12:43











            • @Zaf Khan +1 Good point, I didn't even notice it was set to collapse...

              – MasNotsram
              Apr 23 '13 at 12:47











            • So for THIS example, you're right, SpAm. But trouble still persists and i think that i'm forced to figure it out by myself :) Thanks btw.

              – Kamilius
              Apr 23 '13 at 12:54














            1












            1








            1







            It appears to be the border spacing on the table.



            Apply this CSS to the table element:



            border-spacing: 0;





            share|improve this answer













            It appears to be the border spacing on the table.



            Apply this CSS to the table element:



            border-spacing: 0;






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Apr 23 '13 at 12:34









            MasNotsramMasNotsram

            1,9151123




            1,9151123













            • Nope, added those two into fiddle and code here. Didn't helped

              – Kamilius
              Apr 23 '13 at 12:42






            • 3





              Border-spacing is not valid when the border-collapse is set to 'collapse' it is only used when border-collapse is set to separate!

              – Zeddy
              Apr 23 '13 at 12:43











            • @Zaf Khan +1 Good point, I didn't even notice it was set to collapse...

              – MasNotsram
              Apr 23 '13 at 12:47











            • So for THIS example, you're right, SpAm. But trouble still persists and i think that i'm forced to figure it out by myself :) Thanks btw.

              – Kamilius
              Apr 23 '13 at 12:54



















            • Nope, added those two into fiddle and code here. Didn't helped

              – Kamilius
              Apr 23 '13 at 12:42






            • 3





              Border-spacing is not valid when the border-collapse is set to 'collapse' it is only used when border-collapse is set to separate!

              – Zeddy
              Apr 23 '13 at 12:43











            • @Zaf Khan +1 Good point, I didn't even notice it was set to collapse...

              – MasNotsram
              Apr 23 '13 at 12:47











            • So for THIS example, you're right, SpAm. But trouble still persists and i think that i'm forced to figure it out by myself :) Thanks btw.

              – Kamilius
              Apr 23 '13 at 12:54

















            Nope, added those two into fiddle and code here. Didn't helped

            – Kamilius
            Apr 23 '13 at 12:42





            Nope, added those two into fiddle and code here. Didn't helped

            – Kamilius
            Apr 23 '13 at 12:42




            3




            3





            Border-spacing is not valid when the border-collapse is set to 'collapse' it is only used when border-collapse is set to separate!

            – Zeddy
            Apr 23 '13 at 12:43





            Border-spacing is not valid when the border-collapse is set to 'collapse' it is only used when border-collapse is set to separate!

            – Zeddy
            Apr 23 '13 at 12:43













            @Zaf Khan +1 Good point, I didn't even notice it was set to collapse...

            – MasNotsram
            Apr 23 '13 at 12:47





            @Zaf Khan +1 Good point, I didn't even notice it was set to collapse...

            – MasNotsram
            Apr 23 '13 at 12:47













            So for THIS example, you're right, SpAm. But trouble still persists and i think that i'm forced to figure it out by myself :) Thanks btw.

            – Kamilius
            Apr 23 '13 at 12:54





            So for THIS example, you're right, SpAm. But trouble still persists and i think that i'm forced to figure it out by myself :) Thanks btw.

            – Kamilius
            Apr 23 '13 at 12:54













            1














            Be aware that



            width: 100%;


            does not work the exactly the same way as



            height: 100%;


            does.



            While width: 100% grabs 100% of the parent's width even if there has not been an explicit setting of that width, height: 100% works only on elements whose parents have a fixed height.



            Simply speaking, %-width applies dynamically, while %-height applies to static parents container's heights.






            share|improve this answer




























              1














              Be aware that



              width: 100%;


              does not work the exactly the same way as



              height: 100%;


              does.



              While width: 100% grabs 100% of the parent's width even if there has not been an explicit setting of that width, height: 100% works only on elements whose parents have a fixed height.



              Simply speaking, %-width applies dynamically, while %-height applies to static parents container's heights.






              share|improve this answer


























                1












                1








                1







                Be aware that



                width: 100%;


                does not work the exactly the same way as



                height: 100%;


                does.



                While width: 100% grabs 100% of the parent's width even if there has not been an explicit setting of that width, height: 100% works only on elements whose parents have a fixed height.



                Simply speaking, %-width applies dynamically, while %-height applies to static parents container's heights.






                share|improve this answer













                Be aware that



                width: 100%;


                does not work the exactly the same way as



                height: 100%;


                does.



                While width: 100% grabs 100% of the parent's width even if there has not been an explicit setting of that width, height: 100% works only on elements whose parents have a fixed height.



                Simply speaking, %-width applies dynamically, while %-height applies to static parents container's heights.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jun 16 '14 at 19:22









                connexoconnexo

                21.9k83557




                21.9k83557






























                    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%2f16169171%2fdifferent-100-height-of-table-in-chrome-ie-and-firefox%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