inicio mail me! sindicaci;ón

Example explains element of fixed position of webpage of development study CSS

1.Position:sTatic | Without fixed position

Position:sTatic is the acquiescent value that all elements locate, need not make clear commonly, unless need cancels successive other fixed position

It is quotative content below:

Example:
#div-1 {Position:sTatic;
}

2.Position:rElative | Relative to fixed position

Use Position:rElative, need Top, bottom, left, right4 attribute will cooperate, determine elemental position.

If want to let Div-1 layer be down mobile 20px, left move 40px:

It is quotative content below:

Example:
#div-1 {Position:rElative;Top:20px;Left:40px;
}

If use relative fixed position, prep close behind his layer Divafter is the lower part that won’t appear in Div-1, be in with Div-1 however same height appears.

Visible, position:rElative; is not very good with.

3.Position:aBsolute | Absolutely fixed position

Use Position:aBsolute; , can the very accurate seat that wants elemental shift to you, make my general Div-1a mobile arrive the top right corner of the page:

It is quotative content below:

Example:
#div-1a {Position:aBsolute;Top:0;Right:0;Width:200px;
}

Before the Div-1a layer that uses absolutely fixed position or the layer from the back can think this layer does not exist, a bit does not affect them. So Position:aThe position that Bsolute; uses at putting an element to secure is very good with, but if need Div-1a layer look,decide to the layer around the position does not come true.

The Bug that there is a Win IE here needs to mention, if be the element of absolutely fixed position,define an opposite width namely, so the width that issues it in IE depends on the width of father element the width that is not whole page.

4.Position:rElative Position:aBsolute | Absolutely fixed position relative fixed position

If give father the element (Div-1) definition is Position:rElative; child element (Div-1a) definition is Position:aBsolute, so child element (the position of Div-1a) will be relative at father element (Div-1) , is not whole page.

Let Div-1a be located in the top right corner of Div-1 surely:

It is quotative content below:

Example:
<div Id= "div-1 ">
<div Id= "div-1a ">This Is Div-1a Element.
</div>This Is Div-1 Element.
</div>
#div-1 {Position:rElative;
}
#div-1a {Position:aBsolute;Top:0;Right:0;Width:200px;
}

5.Two Column Layout | Two layout

Let us carry out Position:rElative Position:aThe theory of Bsolute, achieve two distribution.

It is quotative content below:

Example:
<div Id= "div-1 ">
<div Id= "div-1a" >this Is The Column-one</div>
<div Id= "div-1b" >this Is The Column-two</div>
</div>
#div-1 {Position:rElative;/* father element locates relatively */
}
#div-1a {Position:aBsolute;/* child the element locates absolutely */Top:0;Right:0;Width:200px;
}
#div-1b {Position:aBsolute;/* child the element locates absolutely */Top:0;Left:0;Width:200px;
}

Attention, the height that can discover father element in this example won’t as child elemental height changes, if the setting of father element and frame need,define so enough high high talent is shown come.

6.float | Float is right neat

Use Float locates an element has Float:lEft;&float:rIght; is worth two kinds. This kind of fixed position can locate in horizontal coordinate only, cannot locate in perpendicular coordinate. And the left that lets the elemental floating ring below be circled in it or right.

It is quotative content below:

Example:
#div-1a {Float:lEft;Width:200px;
}

7.make Two Clumn With Float | Float achieves two distribution

If let an element Float:lEft; another Float:rIght; has controlled their width, can achieve two position result.

It is quotative content below:

Example:
#div-1a {Float:lEft;Width:150px;
}
#div-1b {Float:lEft;Width:150px;
}
8.clear Float | Cleared float

If you do not want to let use the below elemental floating ring of Float element,be circled in it all round, so you use Clear, clear has 3 values, clear:lEft;(cleared Zun Fu moves) , clear:rIght;(is cleared right float) , clear:bOth;(is cleared and all float) .

It is quotative content below:

Example:
<div Id= "div-1a" >this Is Div-1a</div>
<div Id= "div-1b" >this Is Div-1b</div>
<div Id= "div-1c" >this Is Div-1c</div>

#div-1a {Float:lEft;Width:190px;
}
#div-1b {Float:lEft;Width:190px;
}
#div-1c {Clear:bOth;
}

  
So far, the fixed position part of this Css ended, you can start work experience experience deepens impression.

Practice is the most important

Bookmark:Digg Del.icio.us Reddit

Leave a Comment