html - 如何将我的链接移动到提交按钮的右侧

标签 html ruby-on-rails css ruby-on-rails-3

这是我认为的相关代码:

<%= form_for CustomerEmail.new, :html => {:class => "js-ajax-submit js-customer-email-form invisible", :rel => {:reload => true}.to_json} do |c| -%>
  <%= c.label :email, 'Email' %>
  <%= c.text_field :email %>
  <%= c.submit "Submit", :class => "small-button" %>
  <a href="#" class='js-close-popup'>Cancel</a>
<% end -%>

目前,“取消”链接位于标有“电子邮件”的文本框右侧。我需要将它移到提交按钮的右侧。

我已经尝试了所有我知道的 html 标签:div、span、td、tr、li。这些都没有让我到达我需要到达的地方。 我还尝试了一些 css:style='float: right;填充顶部:5px;向右填充:20px;填充底部:5px'

运气不好....

最佳答案

<%= form_for CustomerEmail.new, :html => {:class => "js-ajax-submit js-customer-email-form invisible", :rel => {:reload => true}.to_json} do |c| -%>
  <%= c.label :email, 'Email' %>
  <%= c.text_field :email %>

  <div style="float: right">
    <%= c.submit "Submit", :class => "small-button", :style => "float: left;" %>
    <div style="display: block; float: left; padding: 5px 0px 5px 20px;">
      <a href="#" class='js-close-popup'>Cancel</a>
    </div>
  </div>
<% end -%>

关于html - 如何将我的链接移动到提交按钮的右侧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8658593/

相关文章:

c# - 使文本字段可见但不可编辑

html - 将单词直接放在其他单词的下方或上方

ruby-on-rails - has_and_belongs_to_many 和关联表上的唯一索引生成 "Duplicate entry"失败

ruby-on-rails - rails : how to add comment on fields?

css - 如何禁用 Angular Material 分页按钮的涟漪效果?

css - 尽管正确配置了 css 文件,但出现静态 404 错误

html - IE 7 自动换行错误

ruby-on-rails - RSpec: NameError: 未初始化的常量 <MyControllerName>

html - 高度可调的粘性页脚

android - 在 android 中通过 Intent 发送 HTML 电子邮件时 CSS 不起作用