可能重复:
为整个表格涂色
如何为表格环境?
\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}
答案1
彩色
尝试一下xcolor
你甚至可以设置交替颜色
\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}
(仅就我个人而言,我想说印刷上的垂直规则很奇怪。避免使用它们。我剥离了它们,\mbox{}..
因为我看不到目的。)
禁忌
该tabu
包为您提供了一些更方便的命令
\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}