By default, vertical-align for baseline table cells. The effect of this can be seen in the first <table> below.
This causes the table contents, text, or <div> be placed around the vertical center.
If you want to move the <div> to the beginning, vertical-align: top; will do the trick. Or a top: 0; .
div#div1 { position: absolute; left: 0; right: 0; height: 100px; border: 1px solid green; background-color: green; width: 100%; box-sizing: border-box; } td { position: relative; border: 1px solid blue; height: 100px; width: 100%; } table { width: 100%; }
<!DOCTYPE html> <html> <body> <table> <tr> <td> Some text </td> </tr> </table> <table> <tr> <td> <div id="div1">This is a heading with an absolute position</div> </td> </tr> </table> </body> </html>
Brett DeWoody
source share