This question was apparently asked at least 10 times here on stackoverflow, but none of them actually answered. This is slightly different in that the problem appears in Firefox.
I have a table height of 100%, a height of tr 100%. I set the td border to what I see. I see that td is 100% as expected. I put the div in td and set it to 100% height. This is 100% in Chrome. This is NOT 100% in Firefox.
How to fix it?
Example
<!DOCTYPE html> <html> <head> <style> body, html { width: 100%; height: 100%; padding: 0px; margin: 0px; } .full { width: 100%; height: 100%; border: 10px solid red; } #content { width: 100%; height: 100%; } #content>table { width: 100%; height: 100%; } #content>table>tbody>tr>td { border: 10px solid blue; width: 50%; } #container { width: 100%; height: 100%; border: 10px solid black; } </style> </head> <body> <div id="content"> <table> <tr> <td> <div id="container"> <div class="full"> foo </div> </div> </td> </tr> </table> </div> </body> </html>
Here is a fragment
body, html { width: 100%; height: 100%; padding: 0px; margin: 0px; } .full { width: 100%; height: 100%; border: 10px solid red; } #content { width: 100%; height: 100%; } #content>table { width: 100%; height: 100%; } #content>table>tbody>tr>td { border: 10px solid blue; } #container { width: 100%; height: 100%; border: 10px solid black; }
<div id="content"> <table> <tr> <td> <div id="container"> <div class="full"> foo </div> </div> </td> </tr> </table> </div>
In Chrome you will see
bbbbbbbbbbb b#########b b#rrrrrrr#b b#rr#b b#rr#b b#rr#b b#rrrrrrr#b b#########b bbbbbbbbbbb
While in Firefox it is
bbbbbbbbbbb bb b#########b b#rrrrrrr#b b#rr#b b#rrrrrrr#b b#########b bb bbbbbbbbbbb
where b = blue td . # = black div, which should be 100%. r = red inner div, which should also be 100% (and apparently, anyway). It is black that is wrong.
What CSS should I fix to make Firefox behave like Chrome in this case?
PS: Yes, I need a table. I am showing tabular data. The above example is simplified for a single cell to simplify debugging.
css
gman Aug 28 '13 at 12:38 on 2013-08-28 12:38
source share