Skip to main content

Command Palette

Search for a command to run...

what is positioning in css?

Published
•1 min read•View as Markdown
D

I am Web Developer interested in web development.

The position CSS property sets how an element is positioned in a document. The top, right, bottom, and left properties determine the final location of positioned elements.

position: static; HTML elements are positioned static by default.it is always positioned according to the normal flow of the page.

position: relative; top: 40px; left: 40px; Setting the top, right, bottom, and left properties of a relatively-positioned element will cause it to be adjusted away from its normal position.

position: absolute;
top: 40px; left: 40px; An absolute positioned element has no positioned ancestors, it uses the document body, and moves along with page scrolling.

position: sticky; top: 20px; A sticky element toggles between relative and fixed, depending on the scroll position. It is positioned relative until a given offset position is met in the viewport - then it "sticks" in place (like position:fixed).

More from this blog

Dubey's blog

10 posts