How to Vertically Align Side-by-Side Minipages
At a glance
- 1. Choose alignment
Use the optional position argument: t for top, c for centered, or b for bottom alignment.
- 2. Start at the top
For reliable top alignment, put \vspace{0pt} at the start of each minipage.
- 3. Place them together
Keep both minipages in the same paragraph and leave enough horizontal space for their widths and gap.
To align two minipage blocks side by side, specify their vertical alignment with the optional argument after \begin{minipage}. The usual choices are [t] for top, [c] for center, and [b] for bottom.
For top alignment, start each minipage with \vspace{0pt}. This makes the top alignment consistent when the contents begin with a heading, a list, or another item that does not establish an ordinary first-line baseline.
Choose the alignment option
The position option controls how the minipage boxes line up with one another. Use the same option on both blocks when you want them aligned in the same way:
[t]aligns them at the top.[c]centers them vertically. This is the default if you omit the option.[b]aligns them at the bottom.
For example, the beginnings of two top-aligned blocks look like this:
\begin{minipage}[t]{0.45\textwidth}
\vspace{0pt}
First block content.
\end{minipage}\hfill
\begin{minipage}[t]{0.45\textwidth}
\vspace{0pt}
Second block content.
\end{minipage}
The minipages are placed next to each other, separated by \hfill, which stretches to use the available horizontal space. Their widths must fit on the line together.
Complete example
This document shows two minipages with different amounts of text. Their headings begin at the same height, while the blocks themselves can have different heights.
\documentclass{article}
\begin{document}
\noindent
\begin{minipage}[t]{0.45\textwidth}
\vspace{0pt}
\textbf{First block}\par
This block has a short paragraph of text.
\end{minipage}\hfill
\begin{minipage}[t]{0.45\textwidth}
\vspace{0pt}
\textbf{Second block}\par
This block has more text, so it is taller. The extra lines do not change
the top alignment: both headings start at the same vertical position.
\end{minipage}
\end{document}
The \noindent prevents paragraph indentation before the first minipage. The \par after each heading starts the following text on a new line. The 0.45\textwidth widths leave room for the stretchable gap between the blocks.
Why add \vspace{0pt}?
A minipage is a box, and its alignment is based on a reference line. With [t], the baseline of the first line in each minipage is used as its reference line, so those baselines align. This does not necessarily align the boxes’ physical top edges when their leading material differs.
At the beginning of a minipage, \vspace{0pt} inserts a zero-length vertical skip before the content; it does not itself start a paragraph. This is a practical idiom that often helps top alignment behave consistently when the content begins with a heading, a list, or other vertical material. The skip itself adds no visible gap. This is a practical fix for the common case where [t] alone does not appear to align the visible content.
If both blocks begin with ordinary paragraphs, [t] may already give the appearance you want. The \vspace{0pt} addition is harmless and makes the example more robust to changes in the content.
Common mistakes
- Using different position options: One block with
[t]and one with[c]will not line up at the top. Use matching options for matching alignment. - Putting a blank line between the minipages: A blank line starts a new paragraph, so the second minipage may move below the first instead of sitting beside it. Keep them together as in the example.
- Making the widths too large: The two widths plus any fixed gap must not exceed the available line width. If they do, LaTeX may wrap the second minipage onto another line.
- Expecting equal heights: Vertical alignment positions the boxes relative to each other; it does not make their contents equally tall. Use fixed-height minipages only if equal box heights are also needed.
- Confusing minipage alignment with text alignment:
[t],[c], and[b]position the minipage boxes. They do not left-align, center, or justify the text inside them.
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.