this is the HTML structure.
the table's height is changed.how to make the paragraph's location fixed?Code:<div id="nav"> <table>...</table> <p>...</p> </div>
| SitePoint Sponsor |
this is the HTML structure.
the table's height is changed.how to make the paragraph's location fixed?Code:<div id="nav"> <table>...</table> <p>...</p> </div>





Hope that helpsCode HTML4Strict:<div id="nav"> <table>...</table> <p style="position:fixed;">...</p> </div>
Last edited by donboe; Aug 15, 2010 at 18:45. Reason: Typo

How do you know how much space the table will need? If someone has set a larger default font size, the table will take up more space than you're expecting, and so may overlap the paragraph below
you're right. but the content of the table are input by the admin. the div's height is fixed.the table's height is dynamic.is there a way to make the paragraph show at the same location on all the pages.

As donboe said, you can use position:fixed and set top/bottom and left/right.
That still doesn't resolve your problem of having a dynamic height table above a fixed position element, unless the div is big enough to cater for the maximum text that will ever be entered in the table, in the maximum font size.
If you know the height of the paragraph, you can specify a padding either on top or bottom of the browser window.
Position fixed is not like absolute, it will always follow the browser window regardless of its parent element's position value. If you don't want to specify a height, then you adjust the bottom padding until the paragraph doesn't overlap with anything anymore.HTML Code:<div id="nav" style="padding-bottom: 50px"> <table>...</table> <p style="position:fixed; bottom: 0; height: 50px">...</p> </div>
Bookmarks