How to set html.displayfor() style attribute?

2.4k Views Asked by At

I am working with ASP.NET MVC 4.0.And my problem is i am not getting a way to define a color of DisplayFor html attribute.

I have a HTML.DispalyFor() which is generating dynamic checkboxes and i want to set its background color to gray.

I have tried to do that by style property but i am not getting the result.I have try below thing :

new {@class="clsColor"}

Style{
   .clsColor = "backgroundcolor:gray";
}

Can any one help me out on this ?

1

There are 1 best solutions below

0
On

First of all use style tags properly. You can set background color by background-color not backgroundcolor:

<style>
.clsColor
{
background-color: gray;
}
</style>