devxlogo

Getting Table Cell Background Colors to Display

Getting Table Cell Background Colors to Display

Some browsers do not display a table cell’s background color unless the cell contains some HTML content. It is often handy to use table cell background colors to “paint” a whole region a different color than the page background. To ensure that every “empty” table cell displays background color, insert a non-breaking space ( ) in the table cell. The following code shows non-breaking spaces being used in the middle row of the table. The bottom row demonstrates what happens with no non-breaking spaces (the yellow will not display in some browsers).

 
Application Benchmark Results
Photoshop    

See this code in action:

Application Benchmark Results
Photoshop
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist