Sign in Registration

Controlling the position of an element on the page, CSS position property

In order to place an element on the page, you must specify its coordinates, that is, set the position. Coordinates can be set in various ways, relative to a particular object. CSS styles correctly there is a special property for this - position . It is intended to set how an element is positioned relative to something, such as a browser window or other objects on the page.


What values ​​does position have? Let's list below:

As you can see, if you use some position values, then you need to apply special properties to change the position of the element: left, top, right, bottom . The values ​​for these properties are usually specified in pixels - px . This is required for the following values: absolute, fixed, relative, sticky . Otherwise, the margin family properties should be used to position the element.

Thus, by using different values ​​of the position property, you can achieve the correct position of the element on the page.

Comments (0)
For commenting sign in or register.

Latest articles

Popular sections


Login to the web version
Android app:
Available on Google Play

Share this

Subscribe to