Home >Web Front-end >HTML Tutorial >How to fix div or table at specified position with css

How to fix div or table at specified position with css

php中世界最好的语言
php中世界最好的语言Original
2018-01-23 09:33:183494browse

This time I will show you how to fix a div or table at a specified position with css. What are the precautions for fixing a div or table at a specified position with css? The following is a practical case, let’s take a look.

.bottomTable{    
background-color: rgb(249,249,249);    
z-index:99999999; position:fixed; bottombottom:0; left:0; width:100%; _position:absolute; /* for IE6 */  
/* _top: expression(document.body.scrollTop+document.body.clientHeight-this.offsetHeight);    */  
_top: expression(document.body.scrollTop+document.body.clientHeight-this.offsetHeight-6); /* for IE6 */  
overflow:visible;   
 }

1. z-index: Set the layer to be at the top level.

2. position:fixed; set positioning.

3. _top: expression(document.body.scrollTop+document.body.clientHeight-this.offsetHeight-6); Bind js through css to control the height of the layer from the top,

this The control layer is at the bottom, and the specific values ​​should be adjusted accordingly according to needs.

4. document.body.scrollTop: body, the scrolling distance of the body label scroll bar, can be replaced by your other label objects (scroll bars exist).

5. document.body.clientHeight, the height of the body tag, can be replaced by your other tag objects.

6, -6, make corresponding changes according to the specific situation.

I believe you have mastered the methods after reading these cases. For more exciting information, please pay attention to other related articles on the php Chinese website!

Related reading:

About how to operate scroll bars in HTML

htmlHow to make thin line tables

HTML basic knowledge, detailed introduction to the style of hyperlink settings

The above is the detailed content of How to fix div or table at specified position with css. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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
Previous article:Detailed syntax of HTMLNext article:Detailed syntax of HTML