:github_url: hide .. meta:: :keywords: padding .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/MarginContainer.xml. .. _class_MarginContainer: MarginContainer =============== **Inherits:** :ref:`Container` **<** :ref:`Control` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` A container that keeps a margin around its child controls. .. rst-class:: classref-introduction-group Description ----------- **MarginContainer** adds an adjustable margin on each side of its child controls. The margins are added around all children, not around each individual one. To control the **MarginContainer**'s margins, use the ``margin_*`` theme properties listed below. \ **Note:** The margin sizes are theme overrides, not normal properties. This is an example of how to change them in code: .. tabs:: .. code-tab:: gdscript # This code sample assumes the current script is extending MarginContainer. var margin_value = 100 add_theme_constant_override("margin_top", margin_value) add_theme_constant_override("margin_left", margin_value) add_theme_constant_override("margin_bottom", margin_value) add_theme_constant_override("margin_right", margin_value) .. code-tab:: csharp // This code sample assumes the current script is extending MarginContainer. int marginValue = 100; AddThemeConstantOverride("margin_top", marginValue); AddThemeConstantOverride("margin_left", marginValue); AddThemeConstantOverride("margin_bottom", marginValue); AddThemeConstantOverride("margin_right", marginValue); .. rst-class:: classref-introduction-group Tutorials --------- - :doc:`Using Containers <../tutorials/ui/gui_containers>` .. rst-class:: classref-reftable-group Theme Properties ---------------- .. table:: :widths: auto +-----------------------+--------------------------------------------------------------------------+-------+ | :ref:`int` | :ref:`margin_bottom` | ``0`` | +-----------------------+--------------------------------------------------------------------------+-------+ | :ref:`int` | :ref:`margin_left` | ``0`` | +-----------------------+--------------------------------------------------------------------------+-------+ | :ref:`int` | :ref:`margin_right` | ``0`` | +-----------------------+--------------------------------------------------------------------------+-------+ | :ref:`int` | :ref:`margin_top` | ``0`` | +-----------------------+--------------------------------------------------------------------------+-------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Theme Property Descriptions --------------------------- .. _class_MarginContainer_theme_constant_margin_bottom: .. rst-class:: classref-themeproperty :ref:`int` **margin_bottom** = ``0`` :ref:`🔗` Offsets towards the inside direct children of the container by this amount of pixels from the bottom. .. rst-class:: classref-item-separator ---- .. _class_MarginContainer_theme_constant_margin_left: .. rst-class:: classref-themeproperty :ref:`int` **margin_left** = ``0`` :ref:`🔗` Offsets towards the inside direct children of the container by this amount of pixels from the left. .. rst-class:: classref-item-separator ---- .. _class_MarginContainer_theme_constant_margin_right: .. rst-class:: classref-themeproperty :ref:`int` **margin_right** = ``0`` :ref:`🔗` Offsets towards the inside direct children of the container by this amount of pixels from the right. .. rst-class:: classref-item-separator ---- .. _class_MarginContainer_theme_constant_margin_top: .. rst-class:: classref-themeproperty :ref:`int` **margin_top** = ``0`` :ref:`🔗` Offsets towards the inside direct children of the container by this amount of pixels from the top. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)` .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)` .. |void| replace:: :abbr:`void (No return value.)`