:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/MarginContainer.xml. .. _class_MarginContainer: MarginContainer =============== **Inherits:** :ref:`Container` **<** :ref:`Control` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` Simple margin container. .. rst-class:: classref-introduction-group Description ----------- Adds a top, left, bottom, and right margin to all :ref:`Control` nodes that are direct children of the container. To control the **MarginContainer**'s margin, use the ``margin_*`` theme properties listed below. \ **Note:** Be careful, :ref:`Control` margin values are different than the constant margin values. If you want to change the custom margin values of the **MarginContainer** by code, you should use the following examples: :: # This code sample assumes the current script is extending MarginContainer. var margin_value = 100 add_constant_override("margin_top", margin_value) add_constant_override("margin_left", margin_value) add_constant_override("margin_bottom", margin_value) add_constant_override("margin_right", margin_value) .. rst-class:: classref-introduction-group Tutorials --------- - :doc:`GUI 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`` All direct children of **MarginContainer** will have a bottom margin of ``margin_bottom`` pixels. .. rst-class:: classref-item-separator ---- .. _class_MarginContainer_theme_constant_margin_left: .. rst-class:: classref-themeproperty :ref:`int` **margin_left** = ``0`` All direct children of **MarginContainer** will have a left margin of ``margin_left`` pixels. .. rst-class:: classref-item-separator ---- .. _class_MarginContainer_theme_constant_margin_right: .. rst-class:: classref-themeproperty :ref:`int` **margin_right** = ``0`` All direct children of **MarginContainer** will have a right margin of ``margin_right`` pixels. .. rst-class:: classref-item-separator ---- .. _class_MarginContainer_theme_constant_margin_top: .. rst-class:: classref-themeproperty :ref:`int` **margin_top** = ``0`` All direct children of **MarginContainer** will have a top margin of ``margin_top`` pixels. .. |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.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`