CSS Position Explained

CSS Position Explained

CSS has several different position values, which are used to specify the position of an element in relation to its normal position.

The most common value is "static," which is the default value and renders an element in its normal position.

Other values include "relative," "absolute," "fixed," and "inherit." The "relative" value specifies the position of an element in relation to its normal position. The element's normal position is where it would be if it were not positioned relative to anything.

The "absolute" value specifies the position of an element in relation to its containing block. The containing block is the nearest ancestor element that is not positioned.

The "fixed" value specifies the position of an element in relation to the viewport.

The viewport is the area of the screen that displays documents. The "inherit" value specifies that an element should inherit its position from its parent element.

Leave a comment

All comments are moderated before being published.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.