在https://login.mailchimp.com/signup上,当您单击表单 (:focus) 时,下方会出现“帮助消息”。例如“你的电子邮件地址是什么?” 出现在电子邮件下方。
我试图分析他们的 css,但我没有在我的代码上应用这样的东西。我想我遗漏了一些重要的东西,比如如何告诉程序我希望它在用户在字段内单击时出现。
这是我的代码
导轨视图:
<%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => {:class => 'form-vertical' }) do |f| %>
<fieldset>
<%= f.error_notification %>
<%= display_base_errors resource %>
<%= f.input :email, :required => true, placeholder: t("devise.registrations.sign_up_page.whats_your_email_address") %>
<div class="field-help"> What's your email address? </div>
<%= f.input :password, :required => true %>
<%= f.input :password_confirmation, :required => true %>
<div class="fullsized"><%= f.button :submit, t("devise.registrations.sign_up_page.sign_up"), :class => 'btn-primary' %>
</div>
</fieldset>
<% end %>
CSS:
.field-help {
-webkit-transition: all 0.25s ease-in-out 0s;
-moz-transition: all 0.25s ease-in-out 0s;
-o-transition: all 0.25s ease-in-out 0s;
-ms-transition: all 0.25s ease-in-out 0s;
transition: all 0.25s ease-in-out 0s;
display: block;
opacity: 0;
max-height: 0;
top: -1.8461538461538463em;
overflow: hidden;
white-space: normal;
width: 100%;
max-width: 550px;
word-wrap: break-word;
font-size: 0.8125em;
line-height: 1.3846153846153846em;
font-weight: 700;
position: relative;
color: #737373;
letter-spacing: .01em
}