views:

391

answers:

5

Hello,

Here's a piece of my HTML code

<div id = "mydiv">
    <% = Html.ActionLink("Some Text","SomeAction")%>
</div>

I'd like to style it in white so that it doesn't conflict with the background, which is also blue. So I did this:

#mydiv {background-color:blue;} 
#mydiv a:link { color:white}

But, it doesn't work -- the color it's still blue. How can I do it? Maybe, I just did not write well the selectors.

Thanks for helping.

+3  A: 
#mydiv a { color:white; }
Darin Dimitrov
+2  A: 

Try removing the :link and just having

#mydiv a { color:white}

this should colour the link white.

I'd recommend using the Firebug plugin for firefox also, this allows you to change the stylesheet and see instant changes as well as see which styles are being applied to each element, which styles are being 'overuled' by other styles etc.

Fermin
+1  A: 

Try:

#mydiv a { color:white}

Also, try remove the whitespace around your Id attribute (just in case): ->

JonoW
A: 

Maybe

<%=Html.ActionLink("Text","Act","Ctrl",new {@style="color:white;"}) %>
luke
+2  A: 

Remove the :link suffix and you should be fine:

#mydiv { background-color:blue; }
#mydiv a { color:white; }

Alternatively you can add a class name to the link:

<div id="mydiv"> 
    <%= Html.ActionLink("Some Text", "SomeAction", 
            new { @class = "class-name" }) %> 
</div> 
Richard Szalay