Meaningless Drivel is fun!
The moose likes HTML, CSS and JavaScript and the fly likes Problem setting bgcolor on a cell Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Problem setting bgcolor on a cell " Watch "Problem setting bgcolor on a cell " New topic

Problem setting bgcolor on a cell

Graham Jessiman

Joined: Jun 13, 2013
Posts: 1
The following code snippet shows a font background color set, along with trying to set the cell background to the same color.

<td align="center" bgColor="#639400">
<span class="eocfield">
<font style="background-color:#639400;">
Open </font>

Attached is what is displayed.... is there a priority hierarchy to the settings?


Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63350

Both bgcolor and the font tag are long-since deprecated; why are they being used? Is this some legacy code from a decade or so ago?

If this is new code, it should be using CSS, not deprecated tags and attributes.

Setting background-color on the <td> element will surely have the effect that you seek.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
It is sorta covered in the JavaRanch Style Guide.
subject: Problem setting bgcolor on a cell
jQuery in Action, 3rd edition