Make all input fields on the same line

若如初见. 提交于 2019-12-04 19:09:09

By what documentation says http://twitter.github.com/bootstrap/components.html#navbar

Just add navbar-form class to your form and pull-left or pull-right

Also you should place it inside a li tag since you are placing it inside a ul

The reason display: inline; on your inputs is not working is because simple_form by default wraps a div tag around every input. There are two ways to fix this problem:

  1. Create a custom wrapper for simple_form

    https://github.com/plataformatec/simple_form#the-wrappers-api

  2. Set both your inputs and the surrounding div to be inline-block:

    .user_nav div, .user_nav input, .user_nav input[type="submit"] {
    
      display: inline-block;
    
    }
    

While the .user_nav input css style theoretically should not be necessary, it helps to specify it just in case there is some other CSS rule somewhere setting inputs to block. If you're sure that inputs are behaving normally, then you should be able to remove the second part of the CSS definition above.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!