How to put text in minipage top-centered?
An image is always adjusted at the bottom. In your case the line has a depth of 0pt but a height of height of image.
To change this behavior you can use the command \raisebox
. For example
\raisebox{-\height}{\includegraphics{image}}
In this case the line will have height of 0pt. To align this with you right site you need a new raising by the height of \strutbox
:
\raisebox{\dimexpr-\height+\ht\strutbox\relax}{\includegraphics{image}}
In this case you will get:
Here the code:
\documentclass{article}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{graphicx}
\usepackage{mwe}
\begin{document}
\begin{mdframed}[roundcorner=10pt,leftmargin=1, rightmargin=1,
linecolor=orange,outerlinewidth=.5,
innerleftmargin=8,innertopmargin=8,innerbottommargin=8]
\begin{minipage}[t]{0.2\linewidth}
\raisebox{\dimexpr-\height+\ht\strutbox\relax}{\includegraphics[width=.88\textwidth]{example-image-a}}
\end{minipage}
\hspace{.1mm}
\begin{minipage}[t]{0.6\linewidth}
\begin{itemize}
\item first line
\item second line
\end{itemize}
\end{minipage}
\end{mdframed}
\end{document}
To make the usage more user friendly you can work with the package adjustbox
.
Usually, you can use the [t] option with minipage to get top alignment:
\begin{minipage}[t]{2in}
first block of text\\
(with multiple lines)
\end{minipage}
\begin{minipage}[t]{3in}
second block of text
\end{minipage}
Unfortunately that doesn't work here with because the text block will be aligned to the bottom of the image (from what I understand, that's the baseline of the image.)
You might take a look at Aligning image and text on top, with minipages, which seems to address the same question.