# How to color the text-line-background in a table?

I'd like to color the background of a single line of text in a some cells of a table. I need to obtain a result like this:

I have tried with \columncolor and \cellcolor but they don't leave me a white border. Here is my sample code:

\begin{tabular}{|l|l|l|}
\hline
ID: \cellcolor{gray}{0.9} & blabla &  blabla \\ \hline
Title: & blabla & blabla \\ \hline
State: & blabla & blabla\\ \hline
Description: & blabla & blabla \\ \hline
Type: & blabla  & blabla \\ \hline
Priority: & blabla & blabla \\ \hline
\end{tabular}

-
Welcome to TeX.sx! A tip: You can use backticks  to mark your inline code –  Corentin Dec 7 '12 at 10:21
possible duplicate of How do I fill table cells with a background color? –  Claudio Fiandrino Dec 7 '12 at 11:12

\documentclass[12pt]{article}

\usepackage{color}

\newcommand\celltitle[1]{{\fboxrule=0pt\fbox{\colorbox[gray]{0.9}{\makebox[3cm]{#1}}}}}

\begin{document}

\begin{tabular}{|l|l|l|}
\hline
\celltitle{ID:}  & blabla &  blabla \\ \hline
\celltitle{Title:} & blabla & blabla \\ \hline
\celltitle{State:} & blabla & blabla\\ \hline
\celltitle{Description:} & blabla & blabla \\ \hline
\celltitle{Type:} & blabla  & blabla \\ \hline
\celltitle{Priority:} & blabla & blabla \\ \hline
\end{tabular}

\end{document}

-

Here is a simple adjustment of your code. It requires the packages color and colortbl. The key point is to define the colour using a \definecolor command.

\documentclass[12pt]{article}

\usepackage{color,colortbl}
\definecolor{Gray}{gray}{0.9}

\begin{document}

\begin{tabular}{|l|l|l|}
\hline
\cellcolor{Gray}ID:  & blabla &  blabla \\ \hline
\cellcolor{Gray}Title: & blabla & blabla \\ \hline
\cellcolor{Gray}State: & blabla & blabla\\ \hline
\cellcolor{Gray}Description: & blabla & blabla \\ \hline
\cellcolor{Gray}Type: & blabla  & blabla \\ \hline
\cellcolor{Gray}Priority: & blabla & blabla \\ \hline
\end{tabular}

\end{document}
`
-
It doesn't give me the white border around the coulored text. –  ital Dec 7 '12 at 10:35