Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing the underline from an Html.ActionLink

I have an Html.ActionLink on my page and I am using the following CSS on it to give it an image and try and remove the underlining.....

a.searchButton
{
    background-image: url(/content/images/DropAcross.png);
    background-repeat: no-repeat;
    height: 16px;
    width: 16px;
    display: block;
    text-decoration: none;
    clear:none;
}

Can anyone see a problem with this? All the CSS properties seem to work apart from the text-decoration: none, which seems to leave the underline in place.

like image 895
Simon Williams Avatar asked Oct 15 '10 15:10

Simon Williams


2 Answers

You would have to look at the rendered html. In Firefox or Google Chrome, right click and choose Inspect Element.

You might find something silly like the searchButton class is being applied to a span that wraps the a tag, in which case, you would get everything working except the link specific rule:

text-decoration:none;
like image 85
awrigley Avatar answered Sep 29 '22 19:09

awrigley


I know that it is old topic, but maybe somebody will considere it helpful -
"text-decoration" attribute, mentioned above, can be passed to ActionLink by construction like this:

@Html.ActionLink("Display_Name","Action_Name",null,new {style="text-decoration:none;"})
like image 41
Guest Avatar answered Sep 29 '22 21:09

Guest