1

In my view I have this link:

@Html.ActionLink(" ", null, null, new { @class = "Edit" })

My Edit css class:

.Edit
{
    background: url("../Images/Edit.png") no-repeat;
    display: inline-block;
    height: 24px;
    width: 24px;
    vertical-align: middle;
    }

Works fine, but I want to display "Edit" when the user hovers the link as alt text. any help will be appreciated.

Stacked
  • 6,892
  • 7
  • 57
  • 73
  • although there are probably ways to achieve this through some hackery, im in agreance with http://www.456bereastreet.com/archive/200905/css_background_images_cannot_and_should_not_have_alternate_text/ if you require alt text the image should be loaded with an image tag in case you HAVE to have alt text on a background image a quick google yielded numerous results http://stackoverflow.com/questions/4216035/css-background-image-alt-attribute – Nicholas King Apr 12 '13 at 10:39
  • Not that it has to do anything with your question, but I suggest you put the text "edit" in the link (1st argument of Actionlink) and the add "text-indent: -9000px;" to the style. This way a screen reader or search engine can also see the text of your link, but it won't appear on the screen. – Michiel Oct 16 '13 at 18:54

1 Answers1

7

Try add title attribute for your link:

@Html.ActionLink(" ", null, null, new { @class = "Edit", title="Edit" })
webdeveloper
  • 17,174
  • 3
  • 48
  • 47