Positioning can be tricky sometimes
The CSS positioning properties allow you to position an element. It can also place an element
behind another, and specify what should happen when an element's content is too big.
Elements can be positioned using the top, bottom, left, and right properties. However, these
properties will not work unless the position property is set first. They also work differently
depending on the positioning method.
There are four different positioning methods.
HTML elements are positioned static by default. A static positioned element is always positioned
according to the normal flow of the page.
Static positioned elements are not affected by the top, bottom, left, and right properties.
An element with fixed position is positioned relative to the browser window.
It will not move even if the window is scrolled:
Note: Internet Explorer supports the fixed value only if a !DOCTYPE is specified.
Fixed positioned elements are removed from the normal flow. The document and other elements
behave like the fixed positioned element does not exist.
Fixed positioned elements can overlap other elements.
A relative positioned element is positioned relative to its normal position.
The content of relatively positioned elements can be moved and overlap other elements, but the
reserved space for the element is still preserved in the normal flow.
Relatively positioned elements are often used as container blocks for absolutely positioned
An absolute position element is positioned relative to the first parent element that has a
position other than static. If no such element is found, the containing block is
Absolutely positioned elements are removed from the normal flow. The document and other elements
behave like the absolutely positioned element does not exist.
Absolutely positioned elements can overlap other elements.
When elements are positioned outside the normal flow, they can overlap other elements.
The z-index property specifies the stack order of an element (which element should be placed in
front of, or behind, the others).
An element can have a positive or negative stack order:
An element with greater stack order is always in front of an element with a lower stack
Note: If two positioned elements overlap, without a z-index specified, the
element positioned last in the HTML code will be shown on top.
Set the shape of an elementThis
example demonstrates how to set the shape of an element. The element is clipped into this shape,
How to show overflow in an element using
scrollThis example demonstrates how to set the overflow property to create a scroll bar
when an element's content is too big to fit in a specified area.
How to set the browser to
automatically handle overflowThis example demonstrates how to set the browser to
automatically handle overflow.
Change the cursorThis example
demonstrates how to change the cursor.
The number in the "CSS" column indicates in which CSS version the property is defined
(CSS1 or CSS2).
Your Query was successfully sent!