HomeStarbucks Pattern Library

Absolute Center

A group of presentational classes for horizontally and vertically centering elements using absolute positioning. To use, apply .absoluteCenter, .absoluteCenter-x, or .absoluteCenter-y to an element to center it within its closest relatively positioned ancestor:

<div className='relative'>
  <div className='absoluteCenter'>I'm centered!</div>
</div>
  • .absoluteCenter centers both horizontally and vertically
  • .absoluteCenter-x centers horizontally on the x axis
  • .absoluteCenter-y centers vertically on the y axis
.absoluteCenter
.absoluteCenter-x
.absoluteCenter-y

Absolute Spread

A presentational class for sizing an element to cover its container using absolute positioning. To use, apply .absoluteSpread to an element to cover its closest relatively positioned ancestor:

<div className='relative'>
  <div className='absoluteSpread'>I cover my container</div>
</div>
.absoluteSpread