How to include multiple Css Class in ActionLink?


Tags: c#,css,asp.net-mvc

Problem :

Let's say I have two Css class like below:

     .btn
     {
          border:1px solid yellow;
     }

     .btn-info
     {
          background-color: blue;
     }

and an ActionLink:

     <li>@Html.ActionLink("Home", "Index", "Home", new { @class = "btn btn-info" })</li>

As you can see I included those css class in ActionLink classes but it takes only first one. How should I add second one to ActionLink Css classes.

Generated Html:

     <a class="btn btn-info" href="/"></a>


Solution :

<li>@Html.ActionLink("Home", "Index", "Home", null, new { @class = "btn btn-info" })</li>

The fourth parameter is for the routeValues and the fifth parameter is for htmlAttributes.


    CSS Howto..

    CSS - How to only apply a style to a div that is inside another div?

    How do you create a scrolling window over a still background image with CSS?

    How to get smaller divs to stack to the right of larger divs?

    How to align two columns of text in CSS

    How to link after the CSS-Animation?

    How to fix maximum width of a div? If contents of that div's exceeds than maximum width, we get scroller?

    How to take in account children for :nth-child

    how to align div's horizontally in CSS

    IE7: CSS & jQuery: dragging up, dragged item is on top, dragging down: dragged item is below. How do I get both to be on top?

    How to reload CSS after ajax call

    How to make Zig Zag borders using CSS? [closed]

    How to include CSS for a specific part of the page

    How to deal with different stylesheets (WYSIWYG Editor and Webpage one) in the same page?

    How to avoid line breaks inside `->` operator in `` blocks?

    How can i give transparency effect in CSS?

    How to access lower children using > operator?

    Google fonts and twitter bootstrap 3: where should I load the fonts, and how to use it in css file?

    How to make input+label in a form appear one by one?

    How to create this responsive grid of different sized images with CSS & HTML, example below

    how do i change the css property for only one row with a custom class with out removing the styles from the other rows?

    How to externally style with CSS the specific 3 td tags on the html table generated by the pager row of a asp.net gridview control

    CSS, how to create a label width of the longest containing text?

    How to apply a CSS height setting to all child elements?

    How to Change the Color of Selected Content

    How to style an asp.net menu with CSS

    CSS- how to give an object with scooped corners a border colour?

    How to reference CSS from libraries installed via npm?

    How to use inline CSS by th:style using “The ? : operator” in ThymeLeaf

    How to align a button inside a DIV

    Transition animation to show hidden content