๐ŸŽฏ Css Positioning Properties ๐Ÿ™‚

๐ŸŽฏ Css Positioning Properties ๐Ÿ™‚

ยท

2 min read

๐Ÿ‘‹WELCOME_BACK AGAIN WITH CSS POSITIONING๐Ÿ™‡โ€โ™‚๏ธ

Hey Folks, welcome back with the new article CSS positioning. In this article, we are going to read the position properties available in CSS. we will know what Positions in CSS what are the types, how it works and so many things. And after reading this article we got some idea about Positions in CSS๐Ÿ˜‡.

let's get startedโฉ

๐Ÿ’ What are Position Properties in CSS?

The properties which are used to manipulate the location or the position of an element are known as "Position properties". It is also used to place an element behind another.

๐ŸŽŸ๏ธTypes of position properties :

Generally, there are five types of position properties used in CSS.

  • ๐Ÿ“ Static

  • ๐Ÿ“ Relative

  • ๐Ÿ“ Absolute

  • ๐Ÿ“ Fixed

  • ๐Ÿ“Sticky

๐ŸŸข Static :

In the static position, the element is positioned according to the normal flow of the document. The default position: top, right, bottom, left, and z-index has no effect. The positions have already been set by default.

Syntax:

             position:static;

๐ŸŸข Relative :

The top, right, bottom, left, and z-index will now work. Otherwise, the element is in the flow of the document like static.

Example:

here in code, we give position relative to box B and when we give the value like left 20px then it moves 20px from its normal position.

๐ŸŸข Absolute :

  • The element is removed from the flow and is relatively positioned to its first non-static ancestor.
  • Its final position is determined by the values of top, right, bottom, and left.

Example:

๐ŸŸข Fixed :

  • It is just like absolute except the element is positioned relative to the browser window.
  • An element with fixed positioning allows it to remain in the same position even we scroll the page.

  • We can set the position of the element using the top, right, bottom, and left.

Example:

๐ŸŸข Sticky :

  • The element is positioned based on the user's scroll position.

  • here in the example element is placed in the middle of the document then when the user scrolls the document, the sticky element starts scrolling until it touches the top.

  • here I'm using the top but We can stick the element at the bottom, with the bottom property.

Example:

Now we got some Idea about the Position properties of CSS. I hope you like it. For better understanding try all the code and theory with your self read it and practice ๐Ÿ˜‡

โค๏ธThank You :) ๐Ÿ™‡โ€โ™‚๏ธ๐Ÿ™‡โ€โ™‚๏ธ๐Ÿ™‡โ€โ™‚๏ธ


ย