is an option for Cell that specifies the absolute margins in printer’s points to leave inside a frame that is drawn around a cell.
CellFrameMargins
is an option for Cell that specifies the absolute margins in printer’s points to leave inside a frame that is drawn around a cell.
Details
- Possible settings are:
-
dist the same margins on all sides {{left,right},{bottom,top}} different margins on different sides - CellFrameMargins defines the margins for the box used to draw the background color of a top-level cell. The margins will be used to define the extent of the background color even if there is no cell frame.
- If Background->None is set or the background matches the ambient background, then the margins are only applied if a CellFrame is present. If the cell frame is not drawn on all sides, then the margin will only be applied to the sides with a frame setting.
- inline and attached cells with a background color and no CellFrame do not apply CellFrameMargins.
Examples
open all close allBasic Examples (2)
Specify the space to be left between contents and frame on all sides:
CellPrint[Table[TextCell[StringJoin[Table["abcd ", {40}]], "Text", CellFrame -> True, CellFrameMargins -> m], {m, 0, 18, 9}]]
Set different frame margins on each side:
CellPrint[TextCell[StringJoin[Table["abcd ", {40}]], "Text", CellFrame -> True, CellFrameMargins -> {{100, 200}, {3, 12}}]]
Scope (3)
Margins specified for a partial cell frame:
CellPrint[TextCell[StringJoin[Table["abcd ", {40}]], "Text", CellFrame -> {{True, False}, {False, True}}, CellFrameMargins -> 20, CellMargins -> {{100, 100}, {10, 10}}]]
Margins specified for a cell with a background color:
CellPrint[TextCell[StringJoin[Table["abcd ", {40}]], "Text", Background -> Lighter@Orange, CellFrameMargins -> 20, CellMargins -> {{100, 100}, {10, 10}}]]
Margins specified for an inline cell with a cell frame:
Row[{1, ExpressionCell[2, CellFrame -> 1, CellFrameMargins -> 5], 3}]A background color alone in an inline cell does not add margins:
Row[{1, ExpressionCell[2, Background -> Gray, CellFrameMargins -> 5], 3}]See Also
Tech Notes
Related Guides
History
Introduced in 1996 (3.0)
Text
Wolfram Research (1996), CellFrameMargins, Wolfram Language function, https://reference.wolfram.com/language/ref/CellFrameMargins.html.
CMS
Wolfram Language. 1996. "CellFrameMargins." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CellFrameMargins.html.
APA
Wolfram Language. (1996). CellFrameMargins. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CellFrameMargins.html
BibTeX
@misc{reference.wolfram_2026_cellframemargins, author="Wolfram Research", title="{CellFrameMargins}", year="1996", howpublished="\url{https://reference.wolfram.com/language/ref/CellFrameMargins.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_cellframemargins, organization={Wolfram Research}, title={CellFrameMargins}, year={1996}, url={https://reference.wolfram.com/language/ref/CellFrameMargins.html}, note=[Accessed: 13-June-2026]}