css practice notes flex impact margins

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/nimeghbia/article/details/90673680

Today, I want to implement a very simple effect

That is, the middle of a control, and then set the distance from the screen to the left and right of the middle remaining control automatically extended

margin-left:`````
margin-right:````````

In fact, on these two

However, So now I did not get. margin is possible, but will not automatically fill the remaining space

Later tracking reason, finally found the reason is because nested outside of flex

I do Andrews, Andrews has a linearlayout, you can set the margin to all self-control, that is, their padding property, so do not set the margin at each child control

I would like to accomplish this is to flex design, so out of a nest

and then look for flex, flex parent element is eventually found inside this stuff align-items

When I start to fill in, this stuff would not be considered a default margin-right, so no matter how settings are not used

Guess you like

Origin blog.csdn.net/nimeghbia/article/details/90673680