i develop my web based application system using java.When i design the pages i have to use position attribute for some eleme开发者_开发百科nts to customize thier position in the page Like :
<table style="position: absolute;top: 100px;">
When i change the resolution of pc the element's position is changed.Any Suggestions to make element's position fixed thanks
try it with:
position: fixed
fixed: The element is positioned relative to the browser window
Any more details? As far as i understand, your table will move because 100px might be smaller or bigger depending on resolution. You may try with some other units, like "5%" or "em", they are a little less depending of resolution.
Make the element that contains the table
have position:relative
. Then the absolutely positioned element will be positioned relative to it's parent.
Example:
<body>
<div id="wrapper" style="position:relative; width:100%; height:100%;">
<table style="position:absolute;top:100px;">
<tr>
<td>...
...
</table>
</div>
</body>
精彩评论