简体   繁体   English

表单在Safari上无法正确对齐,但在Chrome上运行良好

[英]Form doesn't align properly on Safari but works well on Chrome

I have a form that works well on Chrome but it wrap to on Safari in my Ruby on Rails application. 我有一个可以在Chrome上正常运行的表单,但是可以在Ruby on Rails应用程序中的Safari上wrap

Here is the code 这是代码

.panel.panel-primary
  .panel-heading
    h4.panel-title = t('admin.statistic.filter')

  .panel-body
    = form_for form_target, url: url, html: {method: :get, class: 'form-horizontal', :autocomplete => 'off'} do |f|
      .row
        .col.col-xs-3
          = f.datagrid_label :currency
          = f.datagrid_filter :currency, class: "form-control"
        .col.col-xs-3
          = f.datagrid_label :state
          = f.datagrid_filter :state, class: "form-control"
        .col.col-xs-3
          = f.datagrid_label :type
          = f.datagrid_filter :type, class: "form-control"
        .col.col-xs-6
          = f.datagrid_label :created_at
          .form-inline # This is what I used to make it work well on Chrome, but doesn't work on Safari
            = f.datagrid_filter :created_at, class: "form-control"
        .col.col-xs-2
          = f.submit t('datagrid.form.submit'), class: "btn btn-primary", style: "width: 100%"
        .col.col-xs-2
          = link_to t('datagrid.form.clear'), {:controller => 'admin/statistic/orders', :action => 'show'}, class: 'btn btn-primary', style: "width: 100%"

Chrome Look 镀铬外观

镀铬外观

Safari Look Safari外观

Safari外观

.form-inline Is what I used to make it work well on Chrome, but doesn't work on Safari .form-inline是我用来使其在Chrome上正常运行的功能,但在Safari上却无法运行

How can I fix this? 我怎样才能解决这个问题?

可能要检查https://browserstrangeness.bitbucket.io/css_hacks.html#webkit显示可能有助于解决此问题的媒体查询

After reading through grid columns in bootstrap, I figured there is not reason my code should not work well on the two browsers. 在引导程序中阅读了grid columns之后,我认为没有理由我的代码不能在两种浏览器上正常工作。 The problem being that Safari calculates differently. 问题是Safari的计算方式不同。

So, I figured out grid column already past 12 column in Bootstrap 3 and 24 in Bootstrap 4. Upon adjusting the column I feel should be smaller and extend/increased the number of the part that wrap to new line. 因此,我发现grid column已经超出了Bootstrap 3中的12列和Bootstrap 4中的24列。调整该列后,我感觉应该更小并且扩展/增加换行的零件数。 it works fine. 它工作正常。

In other words, I increase this part .col-xs-6 in the snippet below to .col-xs-8 , while I reduced others: 换句话说,我将下面的代码片段中的.col-xs-6部分增加到.col-xs-8 ,同时减少了其他部分:

.col.col-xs-8
          = f.datagrid_label :created_at
          .form-inline # This is what I used to make it work well on Chrome, but doesn't work on Safari
            = f.datagrid_filter :created_at, class: "form-control"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 text-align:center在chrome中有效,在safari中无效 - text-align:center works in chrome, doesn't work in safari Sticky Footer在Safari和Chrome上无法正常运行 - Sticky Footer doesn't work well on Safari and Chrome 垂直对齐在 Chrome 上运行良好,但在 Firefox 上不起作用 - Vertical align works well on Chrome but not working on Firefox setDragImage 在 Safari 中不起作用,但在 Chrome 中起作用(HTML 拖动 API) - setDragImage Doesn't Work In Safari, But Works In Chrome (HTML Drag API) Toggle Switch在Safari和chrome上不起作用,但在Firefox中起作用 - Toggle Switch doesn't work on safari and chrome but works in Firefox Flex 导航栏在 Safari 中不显示,但在 Chrome 中有效 - Flex Navbar doesn't display in Safari but works in Chrome Scroll Snap 在 Safari 中有效,但在 Chrome 和 Firefox 中无效 - Scroll Snap works in Safari but doesn't work in Chrome and Firefox iFrame 在 Chrome 中不起作用(在 FF、IE 和 Safari 中工作正常) - iFrame doesn't work in Chrome (works fine in FF, IE and Safari) -webkit-linear-gradient在Chrome和Safari上效果很好,但在Firefox上效果不佳 - -webkit-linear-gradient works well on Chrome and Safari but don't work on Firefox 选择在Firefox中放置不正确,在chrome / safari中工作 - Select not positioned properly in firefox, works in chrome/safari
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM