Home > Article > Web Front-end > How to fix position using css
This article mainly introduces how to use css to fix the position. It is very good and can easily prompt users with other information. Anyone who is interested can learn about it.
The code is as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>层固定位置练习--by 阿会楠</title> <style type="text/css"> html,body{ overflow:hidden; padding:0; margin:0; width:100%; height:100%; } #_body{ height:100%; overflow-y:scroll; width:100%; height:100%; } #adDiv{ position:absolute; z-index:99999; bottom:10px; left:10px; width:200px; height:30px; border:1px solid #8A9ABB; background:#F0F4F7; font:12px tahoma; text-align:center; line-height:30px; } </style> </head> <body> <div id="adDiv"><a href="http://www.jb51.net/">脚本之家</a></div> <div id="_body"> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> </div> </body> </html>
Related recommendations:
CSS DIV fixed position, not scrolling with the scroll bar_html/css_WEB-ITnose
Show/hide the window as the page scrolls Fixed position element_html/css_WEB-ITnose
How to display the value of the database at a fixed position under the page
The above is the detailed content of How to fix position using css. For more information, please follow other related articles on the PHP Chinese website!