Forms and CssClass on Button - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Forms and CssClass on Button

  • Forms and CssClass on Button
  • I have a button CSS design, but when I set the CssClass to 'mybutton' it sets the Class of the outside DIV of the button to 'mybutton' as well as the <input class='mybutton'.  So the border of my button goes around the entire DIV section rather than just around the button?  Is there anyway to avoid this?
  • Hi David,

    Please note that currently, it is not possible to set css styles to the <input> tag for example. We have a feature request logged in our feedback portal and hopefully we will be able to implement this for our future releases. Here is the link to the description of the feature request where you can vote to increase its popularity.

    One of the options will be to create custom form field controls in your Sitefinity projects using Thunder. You may checkout the following video for more details on how to create it and add your custom logic for the field.

    In addition to this, you may find useful the following article where we have listed the css classes we are using for the forms widget. As you can see from this article, we use for example the sfTxt class for the <input> element in the Textbox widget. So, another option will be to apply your custom styles to the built-in css classes using the !important clause.

    Regards,
    Sabrie Nedzhip
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  • Please note that currently, it is not possible to set css styles to the <input> tag for example.

    Really? Not being able to set a CSS class-name perhaps, but surely, you know that the input tag is a child of the wrapper that you set your custom class-name on, so wouldn't you be able to apply styles to it as such ?

    .mybutton input styles 

  • Hi Sabrie,

    Can you explain me how to add css styles for Mvc form fields?
    Please comment on below post.

    www.sitefinity.com/.../issue-on-applying-styles-to-mvc-fields-on-a-page

    Thanks,
    Balu

  • Still not quite sure how to resolve this.  For example Bootstrap's .form-control needs to be applied to the input.  However, if I use the CssClass from the MVC form, then this will apply the Bootstrap styles to the sfFieldWrap div, which totally messes up the design?  Feather is supposed to work with Bootstrap so how do I solve this on MVC forms?