How to add css class?

Tags: css,

Problem :

@Html.EditorFor(model => model.Screen.Description)

How to add a class or some other attributes to the generated input?

Solution :

The built-in editor template is too generic (it can display arbitrary objects) for such a concept to make sense. You could either

  1. Write your own editor template
  2. If it's only a single property you're displaying you could use a more specific helper method such as Html.TextBoxFor():

    @Html.TextBoxForm(m => m.Screen.Description, new { @class = "myClass" })

    CSS Howto..

    How to copy only referenced .css to dest with gulp?

    How do you replicate this box-shadow effect?

    how to many class share 1 css method in CSS

    How to encapsulate CSS, especially for popups and no iframe involved?

    How to place object in relation to window browser in css/html?

    How to write two CSS files: with and without sourcemap

    How to create CSS3 bounce effect

    How can I fix my CSS/HTML that uses input:checked, to prevent radio button movement?

    how to change other element css when selected element has new class

    What is the best CSS trick to reduce how much HTML you need?

    how to make shape with diagonal div?

    How do I make the whole area of a list item in my navigation bar, clickable as a link?

    Where do I put my CSS, how do I link to it from the master page?

    How to make text appears alitter above using html and css

    How to align the header menu from left? i see a unexpected margin on left. Help please

    How to detect which part of page user is currently on, like on this page?

    make a div fold out to show content

    How to use jQuery to horizontally center an object in the viewport?

    How to add a gradient/filter in the image in CSS

    How to get this partially diagonal shape from an image in CSS

    How to create a sliding navigation with either jquery or css? [closed]

    How to overlay an image inside an image with HTML, CSS

    How to Apply CSS to Facebook Login Button [closed]

    How to use javascript/css to navigate through a pure css carousel/slideshow?

    CSS3 Menu Layout and Gradient not showing

    Angular Material Flexbox - How to add margin between wrapped rows?

    How to make a rectangle mask with css

    does anyone know how to do this css transition? [closed]

    CSS: How to align text to baseline of height-adjusted input element?

    How to position the GWT dialog to the bottom right corner of the browser?