CodesCompiler
πŸ”
HTMLCSSJavaScriptPythonSQLPHPSEOPostsBooksKids About Contact πŸš€ Get Started Free

CSS - bottom Property

CSS - bottom Property

CSS bottom property is used to set the bottom position of a positioned element. It specifies the distance between the bottom edge of the element and the bottom edge of its containing element. Based on the value of the position property, the effect of bottom property, is determined.

Syntax

CSS CODE
bottom: auto | length | percentage | initial | inherit;

Property Values

ValueDescription
autoIt lets the browser calculate the element’s bottom edge position. Default.
lengthIt sets the element’s bottom edge position in length units (eg.10px, 20px etc.). Negative value are valid.
percentageIt sets the element’s bottom edge position in percentage of containing element(e.g. 10%, 20% etc.). Negative values are valid.
initialIt sets the property to its default value.
inheritIt inherits the property from the parent element.

Examples of CSS Border Property

The following examples explain the bottom property with different values.

Bottom Property with Absolute Position

To use bottom property with absolute position, the element must be contained within a parent which itelf should be positioned. The element will then be placed relative to the parent. The distance from the bottom of the parent container edge can be specified in length or percentage values (e.g. 10px, 20% etc.) or auto value. This is shown in the following example.

Example

Preview

Bottom Property with Relative Position

When the bottom property is used with relative position, the element will be placed relative to its normal position. The distance from the bottom of its normal position can be specified in length or percentage values (e.g. 10px, 20% etc.) or auto value. This is shown in the following example.

Example

Preview

Bottom Property with Fixed Position

The fixed position places an element at a specific position, the element stays at the position despite scroll. The position of the element from the bottom can be specified in length or percentage (e.g. 10px, 20% etc.) or auto value. This is shown in the following example.

Example

Preview

Bottom Property with Sticky Position

The sticky position keeps an element fixed relative to its container when scrolling past a specified point. With the bottom property, we can control the distance from the containers bottom edge. Values like auto, 10px, or 10% adjust its sticking behavior accordingly. This is shown in the following example.

Example

Preview

Note: The position β€˜static’ is not impacted by properties top, right, bottom or left. It displays the elements in the order they appear. It is the default position for elements.

Supported Browsers

Property
bottom1.05.01.01.06.0