• Shaarli
  • Tag cloud
  • Picture wall
  • Daily
  • RSS
  • Login
4251 shaares
 
Filters
2 results tagged margins

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

Single-direction margin declarations – CSS Wizardry – Web Performance Optimisation

QRCode

I’m not sure how I arrived at this rule, but I’m really glad I did and I would likely never ever change it. The basic premise is that you should try and define all your margins in one direction. This means always use margin-bottom to push items down the page, and margin-left to push them across the page. I’m going to focus mainly on margin-bottom throughout this article as it’s the most obvious to explain, but this can be applied to both directions (top/bottom, right/left).

https://csswizardry.com/2012/06/single-direction-margin-declarations/
March 13, 2020 at 4:05:21 PM EDT *
css margins webdesign
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