# How do I prevent \cellcolor from over effect of \hline

I'm trying to add HTML code based color to my table, like so:

\usepackage[table]{xcolor}

\begin{tabular}{ |>{\columncolor[HTML]{F2FAF8}}c| p{11cm} |}
\hline
CELL 1 & CELL 2\\ \hline
CELL 1 & CELL 2\\ \hline
CELL 1 & CELL 2\\ \hline
\end{tabular}


however, the cells seem to overflow on top of the \hline, like so:

How do I prevent this from happening?

I tried:

\setlength{\arrayrulewidth}{1pt} \begin{tabular}{ |>{\columncolor[HTML]{F2FAF8}}c| p{11cm} |} \hline CELL 1 & CELL 2\ \hline CELL 1 & CELL 2\ \hline CELL 1 & CELL 2\ \hline \end{tabular}

no go:

• It doesn't really happen (I claim:-) try zooming in or out in your pdf viewer. You could increase the length \arrayrulewidth to have slightly less fragile lines. – David Carlisle May 14 '13 at 13:33
• Seems to work fine when I compile with your minimal example. Are there perhaps other packages you're loading which might be interacting here? – A.Ellett May 14 '13 at 13:33
• I'm generating pngs, not pdfs, with dvipng. – blueberryfields May 14 '13 at 14:07
• @A.Ellett I don't think so. My preamble consists of: \documentclass[12pt]{article} \pagestyle{empty} \usepackage[utf8]{inputenc} – blueberryfields May 14 '13 at 14:18

I claim this is a problem with the dvi driver bleeding the coloured panels too far, but I see the same with dvipng You can compensate by over-printing an uncoloured table over the top so the rules are on top of the colour not adjacent.

Compare

and

\documentclass{standalone}

\usepackage[table]{xcolor}

\begin{document}

\def\foo#1{\begin{tabular}{ |>{#1}c| p{11cm} |}
\hline
CELL 1 & CELL 2\\ \hline
CELL 1 & CELL 2\\ \hline
CELL 1 & CELL 2\\ \hline
\end{tabular}}

\foo{\columncolor[HTML]{F2FAF8}}\llap{\foo{}}

\end{document}

• The text looks bolder though. – Wok Jan 27 '16 at 10:04
• @Wok yes it would be better to arrange that the overprint version uses phantom for the text so just has the rules – David Carlisle Jan 27 '16 at 10:30