# How to split whole page into two unequal size using minipage

I want to split the whole page into two parts. I am going to use left part as a sidebar.

Code:

\documentclass[11pt]{article}
\usepackage{color}
\usepackage[margin=0cm]{geometry}
\usepackage{graphicx}
\definecolor{cvGray}{rgb}{0.44, 0.52, 0.58}

\begin{document}
\colorbox{cvGray} {
\begin{minipage}{0.3\textwidth}
\end{minipage}
}
\begin{minipage}{0.7\textwidth}
\end{minipage}
\end{document}


Output:

Target output:

I generated the Target output with this code:

\documentclass[11pt]{article}
\usepackage{color}
\usepackage[margin=0cm]{geometry}
\definecolor{cvGray}{rgb}{0.44, 0.52, 0.58}

\begin{document}
\begin{picture}(0,0)
\put(-20,-850){\color{cvGray}
\rule{8cm}{81cm}}
\end{picture}
\end{document}


I could have used the above code but it doesn't seem right way to do things. So how could I achieve the target output by using minipage ?

Your boxes do not fit on one line, and you have a word space between them, so they are set one above the other.

parindent\colorbox{cvGray} {fboxsep space
\begin{minipage}{0.3\textwidth}
box content
\end{minipage} space
fboxsep}space
\begin{minipage}{0.7\textwidth}
box content
\end{minipage}

So, you need to remove the word spaces and account for the fboxsep padding added by \colorbox.

Also you need to force the boxes to be full height even when empty.

Something like this, depending a bit how tall you want the split in relation to page head and foot

\documentclass[11pt]{article}
\usepackage{color}
\usepackage[margin=0cm]{geometry}
\usepackage{graphicx}
\definecolor{cvGray}{rgb}{0.44, 0.52, 0.58}

\begin{document}
\vspace*{-\topskip}
\noindent
\colorbox{cvGray} {%
\begin{minipage}[t][\dimexpr\textheight-\baselineskip]{\dimexpr0.3\textwidth-2\fboxsep\relax}
a
\end{minipage}%
}%
\begin{minipage}[t][\dimexpr\textheight-\baselineskip]{0.7\textwidth}
b
\end{minipage}%

\end{document}

• Thanks :) I don't want page head and foot Jun 13, 2020 at 19:18
• ok add \pagestyle{empty} somewhere then @Ahtisham Jun 13, 2020 at 19:35
• where somewhere ? can you give hint Jun 13, 2020 at 19:40
• +1 for getting closer to the answer :) Jun 13, 2020 at 19:40
• actually more or less anywhere in this example. The line before \begin{document} woudl be a good place Jun 13, 2020 at 19:41