In my answer to question How do I repeat the first table row on every page using longtable inside of tcolorbox?
I suggest to (between others) to use makecell package to define head of table and later I sow that the firs row is not colored as expected. It doesn't cover all row. Than I try to correct this with use of cellcolor construct as should be correctly done, when you use multicolumn (simplified MWE from mentioned question):
\documentclass[12pt]{article} \usepackage[utf8]{inputenc} \usepackage[table]{xcolor} \usepackage{longtable} \usepackage{makecell} \renewcommand\theadfont{\bfseries} \usepackage[active,tightpage]{preview} \PreviewEnvironment{longtable}% \setlength\PreviewBorder{1em} \begin{document} \begin{longtable}{|*{9}{b{\dimexpr 0.11\linewidth-2\tabcolsep}|}} \hline \multicolumn{8}{|c|}{\cellcolor{gray!30}{\thead{head\\ 1}}} & \cellcolor{gray!30}{\thead{head\\ 2}} \\ \hline 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\ \hline\hline \endfirsthead \hline 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\ \hline\hline \endhead A & B & C & D & E & F & G & H & I \\ J & K & L & M & N & O & P & Q & R \\ S & T & U & V & W & X & Y & Z & \\ \hline\hline \end{longtable} \end{document} and discover that that head inmulticolumn doesn't has width of it and consequently head background color doesn't fill complete cell.

I Check makecell documentation, but doesn't find valuable information how to stretch actual head to cover entire cell. How to achieve that entire multicolum cell background will be colored?
addendum: for this particular case the stretch \thead over whole \multicolumn can be done on the following way: instead of
\multicolumn{8}{|c|}{\thead{\hfill head\hfill\\ 1}} the multi column cell should be defined as
\multicolumn{8}{|p{\dimexpr 0.88\linewidth-\tabcolsep}|}{\thead{\hfill head\hfill\\ 1}} where \dimexpr 0.88\linewidth-\tabcolsep is the width of multi col cell. then the result is:
however, general solutions are given in answers below.



