In my layout, I have a container div
with display: table
, containing three inner divs with display: table-cell
.
The two outer table-cells have a fixed width, while the inner table-cell has width: 100%
to scale with the browser width.
My challenge is placing a footer div at the bottom of the middle cell using width: 100%
, but it extends beyond the boundaries of the middle table-cell. How can I address this issue?
For reference, please see the example here: https://jsfiddle.net/9opnx9r8/
Below is the HTML code snippet:
html, body { height: 100%; } .cell { display: table-cell; border: 1px solid red; } .cell1, .cell3 { min-width: 150px; } .cell2 { width: 100%; } .text { border: 1px solid green; position: absolute; left: inherit; bottom: 0; width: 100%; height: 70px; }
<div style="display:table; min-height: 100%;"> <div class="cell cell1"> <h1>C1</h1> </div> <div class="cell cell2"> <h1>C2</h1> <ul> <li>List</li> <li>must</li> <li>stay</li> <li>top</li> </ul> <div class="text">FOOTER TEXT HERE</div> </div> <div class="cell cell3"> <h1>C3</h1> </div> </div>