Auto-margin Alignment
We'll cover the following...
We'll cover the following...
Beware of margin: auto alignment on flex items.
When you use margin: auto on flex-items, things can look quite weird. You do need to understand what’s going on. It may result in unexpected results, but I’m going to explain all that.
When you use margin:auto on a flex-item, the direction (left, right or both) that has the value auto will take up any empty spaces available.
That’s a difficult one to catch. Here’s what I mean:
Consider the navigation bar marked up and styled below:
Here’s what we’ve got:
There are a couple of things to note here. So listen up!