2012-03-27 175 views
0

我遇到了Color屬性的問題,我試圖將其應用於菜單li定位標記。CSS顏色屬性

li a:visited {color:red;}li a.selected {color:green;}正確應用,但是li a{color:blue;}沒有被應用。

http://www.virtualpetstore.com

這個類定義的未施加藍色:

.solidblockmenu li a { 
    float: left; 
    color: blue; 
    font-family:Arial Black; 
    font-size:12px; 
    padding: 8px 20px 8px 20px; 
    text-decoration: none; 
    border-right: 1px solid white; 
} 

這是菜單的標記:

<div id="menu2"> 
    <asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false"> 
     <AnonymousTemplate> 
      <ul id="solidmenu" class="solidblockmenu"> 
       <li><a href="~/default.aspx" runat="server">Incinio</a></li> 
       <li><a href="~/empresa.aspx" runat="server">Empresa</a></li> 
       <li><a href="~/webgrupodotnet.aspx" runat="server">Deserollo</a></li> 
       <li><a href="~/webgrupodiseno.aspx" runat="server">Diseno</a></li> 
       <li><a href="~/webgrupomovil.aspx" runat="server">Moviles</a></li> 
       <li><a href="~/asociados.aspx" runat="server">Asociados</a></li> 
       <li><a href="~/contacto.aspx" runat="server">Contacto</a></li> 
       <li><a href="~/Account/Registrar.aspx" id="Registrar" runat="server">Registrar</a></li> 
       <li><a href="~/Account/Login.aspx" id="HeadLogin" runat="server">Log-In</a></li> 
      </ul> 
     </AnonymousTemplate> 
     <LoggedInTemplate> 
      <ul id="solidmenu" class="solidblockmenu"> 
       <li><a href="~/default.aspx" runat="server">Incinio</a></li> 
       <li><a href="~/empresa.aspx" runat="server">Empresa</a></li> 
       <li><a href="~/webgrupodotnet.aspx" runat="server">Deserollo</a></li> 
       <li><a href="~/webgrupodiseno.aspx" runat="server">Diseno</a></li> 
       <li><a href="~/webgrupomovil.aspx" runat="server">Moviles</a></li> 
       <li><a href="~/asociados.aspx" runat="server">Asociados</a></li> 
       <li><a href="~/contacto.aspx" runat="server">Contacto</a></li> 
       <li><span style="width: 25px;"> 
        <asp:LoginStatus ID="headloginstatus" runat="server" LogoutAction="redirect" LogoutText="log out" LogoutPageUrl="~/" /> 
        </span> 
       </li> 
       <li><span> 
        <a href="/Account/ModificarCuenta.aspx" class="modifyuser"> 
         <asp:LoginName ID="headloginname" runat="server" /> 
        </a> 
       </span> 
       </li> 
      </ul> 
     </LoggedInTemplate> 
    </asp:LoginView> 
</div> 

這裏是剩餘ddmenu.css:

.solidblockmenu { 
    margin: 0 0 0 0; 
    padding: 0 0 0 0; 
    float: left; 
    font: bold 13px Arial; 
    overflow: hidden; 
    margin-bottom: 1em; 
    border: 1px solid #625e00; 
    border-width: 1px 0; 
    background: black url("http://i.imgur.com/iTqzs.gif") center center repeat-x; 
} 
.solidblockmenu li { 
    display: inline; 
} 
.solidblockmenu li a { 
    float: left; 
    color: blue; 
    font-family:Arial Black; 
    font-size:12px; 
    padding: 8px 20px 8px 20px; 
    text-decoration: none; 
    border-right: 1px solid white; 
} 
.solidblockmenu li a:visited { 
    color: Red; 
} 

.solidblockmenu li a:hover, .solidblockmenu li a.selected { 
    color: Green; 
    background: transparent url("http://i.imgur.com/mjYcj.gif") center center repeat-x; 
position: relative; 
} 
+0

你嘗試的藍色深淺等了嗎? – Hardryv 2012-03-27 16:53:09

+0

請僅在您的問題上發佈相關的代碼? – Starx 2012-03-27 16:53:13

+0

您是否嘗試過使用RGB值?喜歡'顏色:#00F' – 2012-03-27 16:54:58

回答

0

剛剛嘗試這一點在下面的CSS在你的ddmenu CSS

.solidblockmenu li a:link { 
    float: left; 
    color: blue; 
    font-family:Arial Black; 
    font-size:12px; 
    padding: 8px 20px 8px 20px; 
    text-decoration: none; 
    border-right: 1px solid white; 
} 
2

您已經定義ul li a:link它將覆蓋默認規則(ul li a

嘗試:

ul li a:link {color: blue;} 

或:

.solidblockmenu li a:link {color: blue;} 

附: 根據您提供的示例鏈接,而不是您發佈的代碼。

重寫規則是#Soluciones_derecho2 ul li a:visited, ul li a:link