# colored table with some bold colored lines

How can I have a table with the following specifications:

1. The top and bottom lines are bold and all other horizontal and vertical lines are normal.
2. The whole table lines (including top and bottom lines) are in red color.
3. The whole table have an yellow background.
-

\documentclass{article}

\usepackage{colortbl}

\arrayrulecolor{red}
\def\widehline{%
\noalign{\global\dimen1 \arrayrulewidth
\global\arrayrulewidth8\arrayrulewidth}%
\hline
\noalign{\global\arrayrulewidth\dimen1 }}

\begin{document}

\colorbox{yellow}{%
\begin{tabular}{|l|l|}
\widehline
1&2\\
\hline
aa&bb\\
aaa&bbb\\
\hline
3&4\\
\widehline
\end{tabular}}

\end{document}

-
Possibly \fboxsep=0pt? –  egreg Dec 17 '12 at 0:09
@egreg, possibly, or possibly the OP likes having a border with the yellow being bigger than the table. As @egreg hints if you want the yellow background tight to the table, locally set \fboxsep to zero. –  David Carlisle Dec 17 '12 at 0:13
How can I have vertically centered cells? –  smh Dec 17 '12 at 10:37
Well that is a completely different question. Perhaps m column type from the array package. –  David Carlisle Dec 17 '12 at 10:54

Here's a possibility using the tabu package:

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

\begin{document}

\noindent\begin{tabu}{| l | l | l |}
\taburowcolors1{yellow!90!black..yellow!90!black}
\taburulecolor{red}
\tabucline[1pt]-
column1a & column2a & column3a \\
\tabucline-
column1b & column2b & column3b \\
\tabucline-
column1c & column2c & column3c \\
\tabucline-
column1d & column2d & column3d \\
\tabucline[1pt]-
\end{tabu}

\end{document}


As a personal suggestion, vertical rules are not necessary and your table will look better without them.

-