我在网站上的菜单拒绝改变颜色

时间:2014-02-23 11:31:26

标签: html css visual-studio-2012

当我尝试更改我的类别和部门菜单颜色时,它们不会应用我选择的颜色并保持不变:

.DepartmentsList {
    border: #006600 1px solid;
    text-align: center;
    margin-top: 20px;
    background-color: #006600;
}
.DepartmentsListHead {
border: 1px solid #006600;
background-color: #006600;
background-repeat: repeat;
<%@ Register src="UserControls/DepartmentsList.ascx" tagname="DepartmentsList" tagprefix="uc1" %>
   
<%@ Register src="UserControls/SearchBox.ascx" tagname="SearchBox" tagprefix="uc3" %>

<!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 id="Head1" runat="server">
  <title>Farm Shop: Online Store</title>
  <asp:ContentPlaceHolder id="head" runat="server">
  </asp:ContentPlaceHolder>
</head>
<body>
  <form id="form1" runat="server">
    <div class="Window">
      <div class="Main">
        <div class="Left">
          <div class="Container">
            &nbsp;<uc3:SearchBox ID="SearchBox1" runat="server" />
              <uc1:DepartmentsList ID="DepartmentsList1" runat="server" />
              <uc2:CategoriesList ID="CategoriesList1" runat="server" />

1 个答案:

答案 0 :(得分:0)

首先,我对.NET一无所知,但是,在你的样式表中你调用了类,但在你的代码中你使用了'id'。

尝试将该类添加到标记中,或者在样式表中重命名该类以反映该ID。

例如:

.DepartmentsList {
    border: #006600 1px solid;
    text-align: center;
    margin-top: 20px;
    background-color: #006600;
}

要:

#DepartmentsList {
    border: #006600 1px solid;
    text-align: center;
    margin-top: 20px;
    background-color: #006600;
}

或者:

<uc1:DepartmentsList ID="DepartmentsList1" runat="server" class="DepartmentsList" />

希望这在某种程度上有意义并有所帮助。

此致