Rails simple_form label_html [英] Rails simple_form label_html

查看:139
本文介绍了Rails simple_form label_html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想覆盖输入和输出之间的空白。它在一个表单上的标签 - 可以通过以下方式完成:label_html => ....? github上的示例显示:class =>'special'被传递。我需要在我的.css文件中设置一些东西吗?如果是这样,我将如何做到这一点(意思是,我用一个。,还是一个#,或者什么都不标记)?我得到的CSS有一个simple_form标签,包含一些设置,我猜我需要做类似的事情,但是我很难将这些部分放在一起。



谢谢

解决方案

是的。样式在样式表中完成。您的标签的选择器将是

  .simple_form label.special 
simple_form 类的表单中,所以它的标签是标签

> / code>,它的类是特殊。所以你会在你的css文件中写下这样的内容:

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


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

解决方案

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;
}

这篇关于Rails simple_form label_html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆