Rails simple_form label_html

a 夏天 提交于 2019-12-24 01:13:18

问题


I'd like to override the margin between the input & its label on one form -- can this be done via :label_html => .... ? The example on github shows a :class => 'special' being passed. Do I need to set up something in my .css file? if so, how would I do that (meaning, do I label it with a ., or a #, or nothing)? The css I've got has a "simple_form label" with some settings, I'm guessing I need to do something similar, but I'm just having difficulty putting the pieces together..

Thanks


回答1:


Yes. Styling is done in your stylesheet. A selector for your label would be

.simple_form label.special

Because it is placed inside a form with simple_form class, it's tag is label and it's class is special. So you will write something like this in your css file:

.simple_form label.special {
  margin-right: 30px;
}


来源:https://stackoverflow.com/questions/6353215/rails-simple-form-label-html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!