Problem
I am trying to align minipages on the top but to no avail, I thought that the [t] option is exactly meant for that, but apparently not. The [c] option seems to work better, except for the first minipage which contains yet another box.
What am I doing wrong?
Update
Thanks for the great answer so far. I should mention that a solution should also respect my geometry setting. Taking @egreg's solution for instance:
\documentclass{article}
\usepackage{xcolor}
\usepackage[a4paper,margin=0pt]{geometry}
\begin{document}
\noindent%
\begin{minipage}[t][.1\textheight]{.1\linewidth}
\vspace{-\fboxsep}
\colorbox{gray}{%
\makebox[\dimexpr \linewidth - 2\fboxsep \relax]{%
\color{white}%
\huge S%
}}%%
\end{minipage}%
\colorbox{orange}{%
\begin{minipage}[t][.1\textheight]{.1\linewidth}
\vspace{0pt}
\huge A
\end{minipage}}
\end{document}
You will see that the minipages are aligned, but are offset to the page border. Any remedy for that?
Reprex
\documentclass{article}
\usepackage{xcolor}
\begin{document}
\noindent%
\begin{minipage}[c][.1\textheight][t]{.1\linewidth}%
\colorbox{blue}{%
\makebox[\dimexpr \linewidth - 2\fboxsep \relax]{%
\color{white}%
\huge S
}}%%
\end{minipage}%
\colorbox{gray}{%
\begin{minipage}[c][.1\textheight][t]{.1\linewidth}%
\huge A
\end{minipage}}%
\colorbox{yellow}{%
\begin{minipage}[c][.1\textheight][t]{.1\linewidth}%
a
\end{minipage}}%
\colorbox{orange}{%
\begin{minipage}[c][.1\textheight][t]{.1\linewidth}%
A
\end{minipage}}\\[5cm]
\noindent%
\begin{minipage}[t][.1\textheight][t]{.1\linewidth}%
\colorbox{blue}{%
\makebox[\dimexpr \linewidth - 2\fboxsep \relax]{%
\color{white}%
\huge S
}}%%
\end{minipage}%
\colorbox{gray}{%
\begin{minipage}[t][.1\textheight][t]{.1\linewidth}%
\huge A
\end{minipage}}%
\colorbox{yellow}{%
\begin{minipage}[t][.1\textheight][t]{.1\linewidth}%
a
\end{minipage}}%
\colorbox{orange}{%
\begin{minipage}[t][.1\textheight][t]{.1\linewidth}%
A
\end{minipage}}
\end{document}







\vspace*{-\topskip}before the minipages. – egreg Feb 25 '22 at 22:29\nointerlineskip\vspace*{-\topskip}– egreg Feb 25 '22 at 22:49