• Shaarli
  • Tag cloud
  • Picture wall
  • Daily
  • RSS
  • Login
4247 shaares
Filters

Auto-margin works with absolute positioned elements | Stefan Judis Web Development

QRCode

If you're defining absolute width or height for an absolute positioned element, you can use auto margin to lay out these elements.

https://www.joshwcomeau.com/css/center-a-div/

.box {
  position: absolute;
  inset: 0.5rem;
  width: 7rem;
  height: 7rem;
  margin: auto;
}
https://www.stefanjudis.com/today-i-learned/auto-margin-works-with-absolute-positioned-elements/
July 15, 2024 at 10:51:44 AM EDT *
css margins centering
FILLER
Shaarli · The personal, minimalist, super fast, database-free, bookmarking service by the Shaarli community · Documentation
Fold Fold all Expand Expand all Are you sure you want to delete this link? Are you sure you want to delete this tag? The personal, minimalist, super fast, database-free, bookmarking service by the Shaarli community