0

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

My code:

@Html.ActionLink("Home", "Index", "Home", new {@data_transition = "slide"})
Nalaka526
  • 11,278
  • 21
  • 82
  • 116
taia
  • 61
  • 3
  • 12

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
  • 11,278
  • 21
  • 82
  • 116
Khurshid
  • 954
  • 7
  • 19