Margins inside flexBox

Joined
Jan 24, 2022
Messages
7
Reaction score
0
Hey everyone, would love a few pointers here for styling in RN.

I have a parent container that is flex: 5 for sizing. Then I have child containers inside, of height: '10%'. I also set the marginTop: '10%' for the child. But the marginTop is significantly smaller than the size of the child. Shouldn't they be the same height since they are both '10%' of the parent container? Why does this happen and what is the recommended way to margin inside a flexed parent container?

Many thanks!
 
Joined
Nov 13, 2020
Messages
302
Reaction score
38
Please post the entire html/c ss code you're using. Why? Because I want to see other code like "Are you using
* {
box-sizing: border-box;
}
"?
 
Joined
Jan 24, 2022
Messages
7
Reaction score
0
Please post the entire html/c ss code you're using. Why? Because I want to see other code like "Are you using
* {
box-sizing: border-box;
}
"?
For child container: {height: '10%', marginTop: '10%'}
for parent container: {flex: 5, width: '100%}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,787
Messages
2,569,630
Members
45,335
Latest member
Tommiesal

Latest Threads

Top