<html> <head> <meta charset="utf-8"> <title>锚点、绝对定位---回到顶部</title> <style> /*position:fixed;绝对定位*/ #image2{ margin-left:90%; margin-top:35%; position:fixed; } /* 只是纯粹的设置背景图片位置而已 body{ background-image:url(./111.jpg); background-repeat:no-repeat; background-attachment:fixed; background-position:100% 50%; } */ </style> </head> <body> <a name="top">顶部</a> <div id="image2"> <a href="#top"> <img src="./111.jpg" alt="111"/> </a> </div> <table width="100px" height="500px" border="1" cellspacing="0" cellpadding="5px"> <tr><td>111</td></tr> </table> <hr/> <table width="100px" height="500px" border="1" cellspacing="0" cellpadding="5px"> <tr><td>222</td></tr> </table> </body> </html>
时间: 2024-11-06 07:11:05