[Tex/LaTex] Move table to the right

tables

Is it possible to align table to the right?

I tried \hfill, but seems not working with the tables:

\hfill\begin{table}[h]
\begin{tabular}[t]{l|c|l|c|c|}
\cline{2-5}
Zestawienie VAT: & \cellcolor[HTML]{C0C0C0}\textbf{\begin{tabular}[c]{@{}c@{}}Wartość\\ netto {[}zł{]}\end{tabular}} & \multicolumn{1}{c|}{\cellcolor[HTML]{C0C0C0}\textbf{\begin{tabular}[c]{@{}c@{}}Stawka\\ VAT\end{tabular}}} & \cellcolor[HTML]{C0C0C0}\textbf{\begin{tabular}[c]{@{}c@{}}Wartość\\ VAT {[}zł{]}\end{tabular}} & \cellcolor[HTML]{C0C0C0}\textbf{\begin{tabular}[c]{@{}c@{}}Wartość\\ brutto {[}zł{]}\end{tabular}} \\ \cline{2-5} 
                 & \multicolumn{1}{r|}{}                                                                             & zw                                                                                                         & \multicolumn{1}{r|}{0,00}                                                                       & \multicolumn{1}{r|}{}                                                                              \\ \cline{2-5} 
\end{tabular}
\end{table}

Best Answer

Just insert the \raggedleft directive inside the table environment. I took the opportunity to simplify the code of your tabular, in particular replacing the nested tabulars with the simpler \Centerstack from stackengine and using \rowcolor at the beginning of the fist row.

\documentclass[table]{article}
\usepackage[T1]{fontenc}
\usepackage[usestackEOL]{stackengine}
\usepackage{showframe}
\renewcommand{\ShowFrameLinethickness}{0.2pt}
\usepackage{xcolor} 

\begin{document}

\begin{table}[h]
\raggedleft\begin{tabular}[t]{l|c|l|c|c|}
\cline{2-5}
\rowcolor[HTML]{C0C0C0}\cellcolor{white}Zestawienie VAT: & \bfseries\Centerstack{Wartość\\ netto [zł]} & \bfseries\Centerstack{Stawka\\ VAT} & \bfseries\Centerstack{Wartość\\ VAT [zł]} & \bfseries\Centerstack{Wartość\\ brutto [zł]} \\ \cline{2-5}
                 & & zw & \multicolumn{1}{r|}{0,00} & \\ \cline{2-5}
\end{tabular}
\end{table}

\end{document} 

enter image description here

Related Question