0 votes

When I place ColorRect (or some another kind of control node) inside the MarginContainer, I have this strange margin on the left side: child node's margin always become 8.

node tree
margin 8

Maybe, I don't understand usage of this type of container. Actually, I don't see the difference between functionality of MarginContainer and simple Container.
Please, explain me this kind of behavior.

Thank you.

in Engine by (19 points)

2 Answers

+1 vote
Best answer

Margin container has custom parameters, for top, left, right, and bottom margins, that take an int value that represents the distance in pixels the children are from the container's borders.
Don't confuse it with the common margins that every control has, they are at the end of the inspector.

by (322 points)
selected by

Thank you very much for explanation.

This vague description just confuses me more.

Simple margin container. Adds a left margin to anything contained.

Should we contribute a better explanation? What do you think?

+2 votes

Go in your margin container custon constant field and check "margin left"
I don't know why there is this weird space but this should do the trick.

by (35 points)

Thank you for advice.

Margin disappeared when I set it to zero. Is it a bug?


Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.