0

How to set an image background for a Html.ActionLink()?

My code:

@Html.ActionLink("Home", "Index", "Home", new {@data_transition = "slide"})
Nalaka526
  • 10,740
  • 21
  • 78
  • 115
taia
  • 61
  • 3
  • 11

1 Answers1

0

You need to set @class = "css-classname", like this:

@Html.ActionLink("Home", 
                 "Index", 
                 "Home", 
                 new {@data_transition = "slide"}, 
                 new {@class="css-class-name"})

and in .css

.css-class-name{
    background-image: your image;
}
Nalaka526
  • 10,740
  • 21
  • 78
  • 115
Khurshid
  • 969
  • 7
  • 19