2020年4月24日 星期五

[CSS] Meaning of margin:auto

Background
Sometimes we need to fulfill situation which we want to line up several components in a row and the last component leans on the right most of the div

Solutions
This comes to marginLeft/Right: auto, when we try to mark the container component with margin-left: auto, the container takes all the spaces available to the left hence position the switch button at the right most of the container.
That explains why when we left / right margin the DIV, we can center it at the center.

References

沒有留言:

張貼留言