Tassisto
Tassisto

Reputation: 10345

Apply CSS on button in ASP.net MVC 3

I started experimenting with MVC 3. And I'm stuck with applying the style of an input-button.

Is it possible to apply Css in the View? The code I gave is located in the View.

<input id="newSubItem" type="button" onclick="location.href='javascript:void(0);'" value='New Subitem' /><br/>

Upvotes: 0

Views: 2927

Answers (2)

TwTw
TwTw

Reputation: 547

You have to put link in the view to your css page :

 <link href="@Url.Content("~/CSSPAGE.css")" rel="stylesheet" type="text/css" />

And then you can apply any class you want,for example

<input id="newSubItem" class="CSSClass1" type="buttononclick="location.href='javascript:void(0);'" value='New Subitem' />

Upvotes: 1

Amar Palsapure
Amar Palsapure

Reputation: 9680

Did you try

 <input id="newSubItem" class="myCSSClass" type="button" onclick="location.href='javascript:void(0);'" value='New Subitem' />

Upvotes: 3

Related Questions