is an option which specifies how the contents of a displayed object should be aligned within the available area in the object.


  • The following settings can be given:
  • Automaticdefault alignment based on environment
    Leftleft aligned
    Rightright aligned
    Toptop aligned
    Bottombottom aligned
    Baselinebaseline aligned
    {h,v}separate horizontal and vertical alignments
    xaligned at position x from (left) to (right)
    {x,y}aligned at horizontal and vertical positions x and y from to
    "c"aligned on the specified character in a grid
  • Alignment->Center is equivalent to Alignment->{Center,Center}.
  • In Alignment->{x,y}, y values run from at the bottom to at the top.
  • Alignment->spec indicates that the spec element of an object should align with the spec element of whatever object contains it.
  • With Alignment->Automatic, the alignment for the contents of an object will be based on the alignment specified for whatever object contains it.
  • General settings for Alignment in Grid, Dataset and related constructs can be given as:
  • specapply spec to all items
    {specx}apply horizontal alignments specx at successive horizontal positions
    {specx,specy}apply horizontal alignments specx and vertical alignments specy at successive horizontal and vertical positions
    {specx,specy,rules}also allow explicit rules for individual i,j elements
  • The speck can have the following forms:
  • {s1,s2,,sn}use s1 through sn; then use defaults
    {{c}}use c in all cases
    {{c1,c2}}alternate between c1 and c2
    {{c1,c2,}}cycle through all ci
    {s,{c}}use s, then repeatedly use c
    {s1,{c},sn}use s1, then repeatedly use c, but use sn at the end
    {s1,s2,,{c1,c2,},sm,,sn}use the first sequence of si at the beginning, then cyclically use the ci, then use the last sequence of si at the end
    {s1,s2,,{},sm,,sn}use the first sequence of si at the beginning and the last sequence at the end
    {i1->v1,i2->v2,}specify what to use at positions ik
    {spec,rules}use rules to override specifications in spec
  • With settings of the form {s1,s2,,{},sm,,sn}, if there are more si specified than items across the grid, si from the beginning are used for the first items, and ones from the end are used for the last items.
  • Rules of the form {{imin,imax},{jmin,jmax}}->v can be used to specify alignments for regions of a grid.


open allclose all

Basic Examples  (3)

Align elements around the center of the grid:

Different predefined alignment options for Button:

Align expressions within the panel:

Scope  (3)

Align the contents of a grid to the left:

Align numbers on the decimal point:

Align an element within a grid:

Generalizations & Extensions  (2)

Align the columns of a grid separately:

Align a set of elements within a grid:

Properties & Relations  (2)

Alignment affects the alignment of the entire construct, but not individual lines of text:

TextAlignment is used to align the individual lines of text in a string or expression:

It is often desirable to set both alignments to the same value:

Alignment determines how cells affected by a narrow PageWidth align:

Wolfram Research (2007), Alignment, Wolfram Language function,


Wolfram Research (2007), Alignment, Wolfram Language function,


@misc{reference.wolfram_2020_alignment, author="Wolfram Research", title="{Alignment}", year="2007", howpublished="\url{}", note=[Accessed: 28-February-2021 ]}


@online{reference.wolfram_2020_alignment, organization={Wolfram Research}, title={Alignment}, year={2007}, url={}, note=[Accessed: 28-February-2021 ]}


Wolfram Language. 2007. "Alignment." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (2007). Alignment. Wolfram Language & System Documentation Center. Retrieved from