【发布时间】:2014-04-30 11:54:59
【问题描述】:
我已经搜索了几天并进行了试验,但我无法获得要显示的简单表单 gem 提示 CSS 类。当您将鼠标悬停在表单输入上时,这只是一个显示表单输入提示的类。
我正在使用带有最新 simple_form gem 和基础 5 的 Rails 4.1。我已取消注释该行
b.use :hint, wrap_with: { tag: :span, class: :hint }
CSS 显示了我在表单中包含的提示,该提示包含在 Span class="hint" 中,但未应用我为该类提供的 CSS。
这个的CSS(实际上是SCSS)是:
.simple_form {
.error {
clear: left;
color: black;
display: block;
margin-left: 120px;
}
.hint {
clear: left;
margin-left: 120px;
color: #555;
display: block;
font-style: italic;
}
}
样式丢失了,它只是在那儿无所事事。
这是完整的 CSS,我怀疑有人会想看它,但以防万一那里有善良的灵魂!
<main role="main">
<h2>Sign up</h2>
<div class="form">
<form accept-charset="UTF-8" action="/users" class="simple_form new_user" id="new_user" method="post" novalidate="novalidate"><div style="display:none"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="p1yBwcId1CbmOJChdVQQht+OafY8aX+7i0U71SxdSbc=" /></div>
<div class="form-inputs">
<div class="input string required user_first_name"><label class="string required control-label" for="user_first_name"><abbr title="required">*</abbr> First name</label><input autofocus="autofocus" class="string required" id="user_first_name" name="user[first_name]" type="text" /></div>
<div class="input string required user_last_name"><label class="string required control-label" for="user_last_name"><abbr title="required">*</abbr> Last name</label><input class="string required" id="user_last_name" name="user[last_name]" type="text" /></div>
<div class="input email required user_email"><label class="email required control-label" for="user_email"><abbr title="required">*</abbr> Email</label><input class="string email required" id="user_email" name="user[email]" type="email" value="" /></div>
<div class="input string required user_staff_id"><label class="string required control-label" for="user_staff_id"><abbr title="required">*</abbr> Staff ID</label><input class="string required" id="user_staff_id" name="user[staff_id]" type="text" /></div>
<div class="input string required user_mobile"><label class="string required control-label" for="user_mobile"><abbr title="required">*</abbr> Mobile (with international dialing code. E.g. 07931xxxxxx = 447931xxxxxx)</label><input class="string required" id="user_mobile" name="user[mobile]" type="text" /></div>
<div class="input password required user_password"><label class="password required control-label" for="user_password"><abbr title="required">*</abbr> Password</label><input class="password required" id="user_password" name="user[password]" type="password" /></div>
<div class="input password required user_password_confirmation"><label class="password required control-label" for="user_password_confirmation"><abbr title="required">*</abbr> Password confirmation</label><input class="password required" id="user_password_confirmation" name="user[password_confirmation]" type="password" /></div>
<div class="input string required user_pin field_with_hint"><label class="string required control-label" for="user_pin"><abbr title="required">*</abbr> 4 digit PIN</label><input class="string required" id="user_pin" name="user[pin]" type="text" /><span class="hint">Type a number in here</span></div>
<div class="input string required user_pin_confirm field_with_hint"><label class="string required control-label" for="user_pin_confirm"><abbr title="required">*</abbr> Confirm PIN</label><input class="string required" id="user_pin_confirm" name="user[pin_confirm]" type="text" /><span class="hint">And the same number again</span></div>
</div>
<div class="form-actions">
<input class="button" name="commit" type="submit" value="Sign up" />
</div>
</form>
非常感谢您能提供帮助 - 我很感激它非常具体;)
【问题讨论】:
标签: css ruby-on-rails zurb-foundation simple-form