I have a form with a table inside a fieldset.
I want to control the background color of the embedded table, which is a 2 x 3.
I've tried all the fixes I could find on this site and none of them worked.
Specifically,

<style type="text/css">
  .txt {color: darkred; background-color: lightgray;} - this works for a cell
  .table1 {background-color: lightgray;} - this doesn't work for the table
    </style>

<style type="text/css">    
  table{background-color: lightgray;} - this doesn't work for the table
    </style>

I've tried these in a CSS file and as shown above, neither works.

HELP!

Thanks.

Recommended Answers

All 3 Replies

Hi there,

Tables background color can be assigned by code as shown below:

<HTML> 
<HEAD> 
<TITLE> Table Background</TITLE> 
<style type="text/css"> 
.tablecolor
{
background-color:lightgrey;
border:1px solid grey;
}
.rowcolor
{
background-color:#ABABAB;
border:1px solid black;
}
BODY { TEXT-DECORATION: none; 
    font-family:verdana; 
    font-size: 9pt; 
    text-indent: 20px; 
} 
</style> 
</HEAD> 
<BODY> 
<center> 
<br><br> 
<table class="tablecolor">
<tr class="rowcolor">
<td>Row1,Column1 </td>
<td>Row1,Column2</td>
<td>Row1,Column3</td>
</tr>
<tr class="rowcolor">
<td>Row2,Column1</td>
<td>Row2,Column2</td>
<td>Row2,Column3</td>
<tr>
</center> 
</BODY> 
</HTML>

I think it might help you in clearing your doubt.

Regards
Surya

Surya,

Thanks for your reply. It was very helpful.

Rick.

Your welcome Rick. It's my pleasure if you find it helpful.

Regards
Surya

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.