7

I am designing one page in which i need to write 3 mdframed side by side. but all three must be having same height.

  <mdframed1>   <mdframed2>  <mdframed3>

How can i implement this?

3

You can place each mdframed inside a minipage of the desired width (in this way, you can place sevearl mdframes side-by-side); inside each mdframed you can use a \parbox (or another minipage) of the predefined height. In the example below I implement this idea using a command with a mandatory argument (for the contents of the mdframed) and an optional argument to pass options to mdframed, but of course, you can implement the idea in any other way that suits your needs:

\documentclass{article}
\usepackage[framemethod=tikz]{mdframed}

\newcommand\FixedHt[2][]{%
  \begin{minipage}[t]{.30\textwidth}
  \begin{mdframed}[roundcorner=5pt,#1]
  \parbox[t][8cm][t]{\linewidth}{#2}
  \end{mdframed}%
  \end{minipage}%
}

\begin{document}

\noindent\FixedHt[backgroundcolor=cyan!20]{Some text}\hfill\FixedHt[backgroundcolor=orange!20]{Some text}\hfill\FixedHt[backgroundcolor=green!20]{Some text}\par

\end{document}

enter image description here

3

Easy job with tcolorbox:

\documentclass{article}
\usepackage{tcolorbox}
\newtcbox{\mybox}[1][]{%
  nobeforeafter,
  colframe=gray,
  boxrule=0.5pt,
  minipage,
  width=0.3\linewidth,
  height=8cm,               %%% <--- change here
  arc=3pt,
  boxsep=0pt,
  #1
  }

\begin{document}

\noindent
\mybox[colback=cyan!20]{Some text}
\hfill
\mybox[colback=orange!20]{Some text}
\hfill
\mybox[colback=green!20]{Some text}

\end{document}

enter image description here

If you want to fit the contents within the box of specified height, look for fitbox option in tcolorbox (page 59, section 3.13)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.