({{, (RefLink[Alignment, paclet:ref/Alignment]) 
is an option which specifies how the contents of a displayed object should be aligned within the available area in the object.}})

OpenersNotesSection(Spacer1)Details

The following settings can be given:

(RefLink[Alignment, paclet:ref/Alignment])->(RefLink[Center, paclet:ref/Center]) is equivalent to (RefLink[Alignment, paclet:ref/Alignment])->{(RefLink[Center, paclet:ref/Center]),(RefLink[Center, paclet:ref/Center])}.

In (RefLink[Alignment, paclet:ref/Alignment])->{x,y}, y values run from -1 at the bottom to +1 at the top.

(RefLink[Alignment, paclet:ref/Alignment])->spec indicates that the spec element of an object should align with the spec element of whatever object contains it.

With (RefLink[Alignment, paclet:ref/Alignment])->(RefLink[Automatic, paclet:ref/Automatic]), the alignment for the contents of an object will be based on the alignment specified for whatever object contains it.

General settings for (RefLink[Alignment, paclet:ref/Alignment]) in (RefLink[Grid, paclet:ref/Grid]) and related constructs can be given as:

The (Subscript[spec, k]) can have the following forms:

With settings of the form {(Subscript[s, 1]),(Subscript[s, 2]),…,{…},(Subscript[s, m]),…,(Subscript[s, n])}, if there are more (Subscript[s, i]) specified than items across the grid, (Subscript[s, i]) from the beginning are used for the first items, and ones from the end are used for the last items.

Rules of the form {{(Subscript[i, min]),(Subscript[i, max])},{(Subscript[j, min]),(Subscript[j, max])}}->v can be used to specify alignments for regions of a grid.

OpenersPrimaryExamplesSection(Spacer1)Examples  (9)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Align elements around the center of the grid:

Grid[{{Graphics[Rectangle[],ImageSize->20],Graphics[Rectangle[],ImageSize->30]},{Graphics[Rectangle[],ImageSize->40],Graphics[Rectangle[],ImageSize->50]}},Alignment->{{Right,Left},{Bottom,Top}},Frame->All]

Different predefined alignment options for (RefLink[Button, paclet:ref/Button]):

Row[Table[Button["y",ImageSize->{Automatic,50},Alignment->a],{a,{Top,Center,Bottom}}],"xxx"]

Align expressions within the panel:

Grid[Table[Panel[x+y+z,ImageSize->{100,50},Alignment->{w,h}],{h,{Top,Center,Bottom}},{w,{Left,Center,Right}}]]

OpenersExampleSection1(Spacer1)Scope  (3)

Align the contents of a grid to the left:

Grid[{{a,bbbb},{ccc,d}},Alignment->Left,Frame->All]

Align numbers on the decimal point:

Grid[{{1.234,12.34},{123.4,1234.},{1234,1.234}},Alignment->"."]

Align an element within a grid:

Grid[{{Item[a,Alignment->Left],bbbb},{ccc,d},{e,f}}]

OpenersExampleSection2(Spacer1)Generalizations & Extensions  (2)

Align the columns of a grid separately:

Grid[{{"first",1},{"second",100}},Alignment->{{Right,Left}}]

Align a set of elements within a grid:

Grid[{{a,bbbb},{ccc,d},{e,f}},Alignment->{Center,Automatic,{{1,1}->Left,{2,2}->Right}}]

OpenersExampleSection4(Spacer1)Properties & Relations  (1)

(RefLink[Alignment, paclet:ref/Alignment]) affects the alignment of the entire construct, but not individual lines of text:

Panel[Framed["Fish\nand fries"], ImageSize->100,Alignment->Right]

(RefLink[TextAlignment, paclet:ref/TextAlignment]) is used to align the individual lines of text in a string or expression:

Panel[Framed["Fish\nand fries",BaseStyle->{TextAlignment->Right}], ImageSize->100]

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

Panel[Framed["Fish\nand fries",BaseStyle->{TextAlignment->Right}], ImageSize->100,Alignment->Right]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[TextAlignment, paclet:ref/TextAlignment])  ▪  (RefLink[AlignmentPoint, paclet:ref/AlignmentPoint])  ▪  (RefLink[BaselinePosition, paclet:ref/BaselinePosition])  ▪  (RefLink[Item, paclet:ref/Item])  ▪  (RefLink[Inset, paclet:ref/Inset])  ▪  (RefLink[ControlPlacement, paclet:ref/ControlPlacement])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Options for Cells, paclet:tutorial/OptionsForCells])}, {▪(RefLinkPlain[Redrawing and Combining Plots, paclet:tutorial/RedrawingAndCombiningPlots])}, {▪(RefLinkPlain[Tables and Matrices, paclet:tutorial/TablesAndMatrices])}, {▪(RefLinkPlain[Grids, Rows, and Columns, paclet:tutorial/GridsRowsAndColumnsOverview])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Grids & Tables, paclet:guide/GridsAndTables])}, {▪(RefLinkPlain[Combining Graphics, paclet:guide/CombiningGraphics])}, {▪(RefLinkPlain[Options & Styling for Interactive Manipulation, paclet:guide/OptionsAndStylingForInteractiveManipulation])}, {▪(RefLinkPlain[Layout & Tables, paclet:guide/LayoutAndTables])}, {▪(RefLinkPlain[User Interface Structuring & Layout, paclet:guide/UserInterfaceStructuringAndLayout])}})}})