[Tex/LaTex] How to reduce space between header and text

header-footer

I m using mdframed as header. Now i want to reduce the space between header and first line on page. How can i reduce the space?

 \documentclass{article}
 \usepackage{array,multirow}
 \usepackage[table]{xcolor}
 \usepackage{fancyhdr}
 \usepackage[framemethod=TikZ]{mdframed}
 \usepackage[top=2cm, bottom=2cm, left=1cm, right=1cm]{geometry}
 \pagestyle{fancy}
 \fancyhf{} % sets both header and footer to nothing 
 \renewcommand{\headrulewidth}{0pt}
 \fancyfoot{}
 \begin{document}

 \arrayrulecolor{white}


 \definecolor{textcol}{rgb}{.118, .565, 1.00}   


 \fancyhead[C]{% 
 \begin{mdframed}[linecolor=blue!60,roundcorner=3pt] 
 \parbox[t]{0.333\textwidth}{\raggedright XXX }% 
 \parbox[t]{0.333\textwidth}{\centering \thepage}%  
 \parbox[t]{0.333\textwidth}{\raggedleft YYY} 
 \end{mdframed}% 
} 

Some text 

\end{document}

Best Answer

You can do it with reducing headsep using geometry package.

 \documentclass{article}
 \usepackage{array,multirow}
 \usepackage[table]{xcolor}
 \usepackage{fancyhdr}
 \usepackage[framemethod=TikZ]{mdframed}
 \usepackage[top=2cm, bottom=2cm, left=1cm, right=1cm,headsep=4pt]{geometry}  %% adjust here
 \pagestyle{fancy}
 \fancyhf{} % sets both header and footer to nothing 
 \renewcommand{\headrulewidth}{0pt}
 \fancyfoot{}
 \begin{document}

 \arrayrulecolor{white}


 \definecolor{textcol}{rgb}{.118, .565, 1.00}   


 \fancyhead[C]{% 
 \begin{mdframed}[linecolor=blue!60,roundcorner=3pt] 
 \parbox[t]{0.333\textwidth}{\raggedright XXX }% 
 \parbox[t]{0.333\textwidth}{\centering \thepage}%  
 \parbox[t]{0.333\textwidth}{\raggedleft YYY} 
 \end{mdframed}% 
} 

Some text 

\end{document}

However, reducing headsep will spoil the consistency and elegance.

enter image description here