We've gotten pretty deep into the weeds here, and we have one more thing to look at. It's the "final boss" of this topic, the culmination of all the rules we've seen so far.
What if we have multiple margins competing for the same space, and some are negative?
If there are more than 2 margins involved, the algorithm looks like this:
- Find the largest positive margin
- Find the largest* negative margin
- Add those two numbers together Here's an example in code.
In this example, our most significant positive margin is 30px. Our most significant negative margin is -20px. Therefore, we wind up with 10px of realized margin, since we add the positive and negative values together.
(No 3D illustration for this one — honestly, it was too busy and chaotic-looking to offer much clarity 😅)
Latest comments (0)