The following will be discussed in this lesson:
The principle behind CSS positioning
Imagine a browser window as a system of coordinates:The principle behind CSS positioning is that you can position any box anywhere in the system of coordinates.
Let's say we want to position a headline. By using the box model (see lesson 9) the headline will appear as follows:
If we want this headline positioned 100px from the top of the document and 200px from the left of the document, we could type the following in our CSS:
The result will be as follows:
As you can see, positioning with CSS is a very precise technique to place elements. It is much easier than trying to use tables, transparent images or anything else.
Absolute positioning
An element which is positioned absolute does not obtain any space in the document. This means that it does not leave an empty space after being positioned.To position an element absolutely, the
position
property is set as absolute. You can subsequently use the properties left, right, top, and bottom to place the box.As an example of absolute positioning, we choose to place 4 boxes in each corner of the document:
show example
Relative positioning
To position an element relatively, the propertyposition
is set as relative. The difference between absolute and relative positioning is how the position is being calculated.The position for an element which is relatively positioned is calculated from the original position in the document. That means that you move the element to the right, to the left, up or down. This way, the element still obtains a space in the document after it is positioned.
As an example of relative positioning, we can try to position three pictures relatively to their original position on the page. Notice how the pictures leave empty spaces at their original positions in the document:
show example
Ι feel thаt iѕ onе of the such a lοt sіgnifіcant іnfоrmаtiοn fоr mе.
ReplyDeleteAnd і am glad studуing your аrtiсlе.
Hοωеver should remаrκ on somе common things, The
wеbsite style iѕ pеrfect, the artiсlеs is trulу grеat
: D. Goοd prоcess, cheeгs
Feel free to ѵіѕit my web-sіtе: Creer site
This post ωill аssist the intеrnet vіѕitorѕ for buildіng up new blog or even a
ReplyDeleteblog from start to end.
mу weblоg; crear pagina web