Home > Web Front-end > CSS Tutorial > How to fix position using css

How to fix position using css

墨辰丷
Release: 2018-05-09 17:37:56
Original
1953 people have browsed it

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>
Copy after login

Related recommendations:

vue listens to the scroll event for an element to be ceiling-mounted or fixed Detailed explanation of position display

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template