我有一個Div,裏面有一個表格(2x2)。我也有一個CSS文件,但我不遵循如何更改ASP.NET DropDown存在的表列的背景顏色。我想:CSS來改變ASP.NET服務器控件的背景顏色
編輯
<%@ 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>
我嘗試的CSS:
body
{
}
table
{
border-color:Olive;
border-style:solid;
border-collapse:collapse;
}
table td
{
width:200px;
}
table.DropDownList
{
width:200px;
background-color:Gray;
}
是這個DropDown元素的類名,它也叫DropDown?發佈簡單版本的表格代碼。 –
顯示您的HTML輸出。 –
不,我只是嘗試DropDown來覆蓋所有DropDown,因爲我使用了表格。沒有課程名稱。 – RKh