VOOZH about

URL: https://www.geeksforgeeks.org/bootstrap/bootstrap-5-position/

⇱ Bootstrap 5 Position - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Bootstrap 5 Position

Last Updated : 26 Jul, 2024

Bootstrap 5 Position offers utility classes to control the positioning of elements. It includes classes like "position-static," "position-relative," "position-absolute," etc., facilitating precise element positioning on web pages for improved layout and design control.

NameDescription
position-staticDefault position, The element follows normal document flow, unaffected by positioning.
position-relativePositioned relative to its normal position, can be moved with top, right, bottom, and left.
position-absolutePositioned relative to its nearest positioned ancestor, doesn't affect other elements.
position-fixedPositioned relative to the viewport, stays fixed even if the page is scrolled.
position-stickyActs like position: relative until it hits a specified threshold, then behaves like fixed.
Arrange elementsEdge positioning utilities, format {property-position} for arranging elements.
Center elementsUse class .translate-middle with edge positioning to center elements via transformations.
SassDefault position utility values declared in Sass.
MapsDefault position utility values declared in Maps.
Utilities APIPosition utilities declared in the utility API.

Example 1: The following code demonstrates Bootstrap Position using various classes:

Output:


Example 2: The following code demonstrates Bootstrap Position using various classes:

Output:


Comment

Explore