Apply CSS for Razor control in Asp.Net MVC4 -


how apply width razor control @html.radiobuttonfor in mvc4?

usermodel.cs

public string emp_gender{get; set;} 

index.cshtml

@model mvcapplication.model.usermodel  @using (html.beingform()) { @html.radiobuttonfor(m=>m.emp_gender,"male")male @html.radiobuttonfor(m=>m.emp_gender,"female")female } 

razor:

@html.radiobuttonfor(m=>m.emp_gender,"male", new { @class = "male"})male @html.radiobuttonfor(m=>m.emp_gender,"female", new { @class = "female"})female 

css:

input[type=radio].male {    width: 150px; }  input[type=radio].female {    width: 300px; } 

however, bear in mind browsers can bit finicky styling of radio buttons.
check link information possible:
http://www.456bereastreet.com/lab/styling-form-controls-revisited/radio-button/
(a bit outdated, still relevant)


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -