# How to color the background of a table? [duplicate]

Possible Duplicate:
Color entire table

How can I color the background of a tabular environment?

\documentclass{scrartcl}
\usepackage[ngerman]{babel}
\usepackage{color}

\begin{document}

\mbox{}\hfill\begin{tabular}{|lp{10cm}|}
\hline
\multicolumn{2}{|c|}{\textbf{Test}}\\
\hline
Test: & Test\\
Test: & Test\\
\hline
\end{tabular}\hfill\mbox{}

\end{document}

-

## marked as duplicate by Ignasi, Andrew Swann, lockstep, Kurt, ThorstenDec 12 '12 at 16:08

Welcome to TeX.sx!. Check this related question – texenthusiast Dec 12 '12 at 14:53
I think you will find the answer in Color entire table. If not, please, explain it better. – Ignasi Dec 12 '12 at 14:58

## Xcolor

Try xcolor You can even set alternating colors

\documentclass[table]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage{xcolor}

\begin{document}
\colorbox{red}{
\begin{tabular}{|lp{10cm}|}
\hline
\multicolumn{2}{|c|}{\textbf{Test}}\\
\hline
Test: & Test\\
Test: & Test\\
\hline
\end{tabular}
}

\rowcolors*{1}{red}{red}
\begin{tabular}{|lp{10cm}|}
\hline
\multicolumn{2}{|c|}{\textbf{Test}}\\
\hline
Test: & Test\\
Test: & Test\\
\hline
\end{tabular}

\end{document}


(Just for my sake i'd like to say that typographically spoken vertical rules are odd. Avoid them. And i stripped \mbox{}.. cause i can't see the purpose. )

## Tabu

The tabu Package provides you with some more convenient commands

\documentclass[table]{scrartcl}
\usepackage{xcolor}
\usepackage{tabu}

\begin{document}

\taburowcolors [1] 7 {green .. brown}

\begin{tabu}{|lp{10cm}|}
\hline
\multicolumn{2}{|c|}{\textbf{Test}}\\
\hline
Test: & Test\\
Test: & Test\\
Test: & Test\\
Test: & Test\\
Test: & Test\\
Test: & Test\\
\hline
\end{tabu}

\end{document}


-
I get the error: "LaTeX Error: File `colortbl.sty' not found." – guest Dec 12 '12 at 15:04
Ok, I guess the [table] option belongs to xcolor. – guest Dec 12 '12 at 15:07