I have a Div with a table (2×2) inside it. I also have a CSS file but I am not following how to change the background color of table columns where ASP.NET DropDown exists. I tried:
Edited
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="ddl1.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
<link href="Stylesheet1.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>
<asp:DropDownList ID="ddl1" runat="server"></asp:DropDownList>
</td>
<td></td>
</tr>
<tr>
<td>
<asp:DropDownList ID="ddl2" runat="server"></asp:DropDownList>
</td>
<td></td>
</tr>
</table>
</div>
</form>
</body>
</html>
The CSS I attempted:
body
{
}
table
{
border-color:Olive;
border-style:solid;
border-collapse:collapse;
}
table td
{
width:200px;
}
table.DropDownList
{
width:200px;
background-color:Gray;
}
Best guess without full HTML:
EDIT:
But this will colour all of your cells, even those not containing SELECT.
You need to use JavaScript. jQuery makes this quite easy: