Note that there are some explanatory texts on larger screens.

plurals
  1. POCSS: Extending input box in a form generated with Rails' `form_for`?
    primarykey
    data
    text
    <p>So I'm pretty new to frontend, so I have a simple CSS question:</p> <p>I have a form generated with Devise with the <code>form_for</code> method as follows:</p> <pre><code>&lt;%= form_for(resource, :as =&gt; resource_name, :url =&gt; session_path(resource_name), :html =&gt; {:class =&gt; "form-signin"} ) do |f| %&gt; &lt;div class="account-wall"&gt; &lt;%= f.email_field :email, class: 'form-control', autofocus: true, placeholder: 'Email' %&gt;&lt;br /&gt; &lt;%= f.password_field :password, class: 'form-control', autofocus: true, placeholder: 'Password' %&gt; &lt;% if devise_mapping.rememberable? -%&gt; &lt;div&gt;&lt;%= f.check_box :remember_me %&gt; &lt;%= f.label :remember_me %&gt;&lt;/div&gt; &lt;% end %&gt; &lt;%= f.submit "Sign in" %&gt; &lt;/div&gt; &lt;% end %&gt; &lt;%= render "devise/shared/links" %&gt; </code></pre> <p>My stylesheets:</p> <pre><code>.form-signin { max-width: 330px; padding: 15px; margin: 0 auto; padding-top: 5px; } .account-wall { margin-top: 20px; padding: 40px 0px 20px 0px; background-color: #f7f7f7; -moz-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3); -webkit-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3); box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3); } .form-signin .form-control { position: relative; font-size: 12px; height: auto; padding: 6px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } </code></pre> <p>This is what the code above produces:</p> <p><img src="https://i.stack.imgur.com/42Hsn.png" alt="enter image description here"></p> <p>What is the easiest way to center the input boxes/remember me/button within the <code>account-wall</code> and make them a bit wider?</p> <p>Generated HTML:</p> <pre><code> &lt;div class="container"&gt; &lt;form accept-charset="UTF-8" action="/guest/actives/sign_in" class="form-signin" id="new_active" method="post"&gt;&lt;div style="margin:0;padding:0;display:inline"&gt;&lt;input name="utf8" type="hidden" value="&amp;#x2713;" /&gt;&lt;input name="authenticity_token" type="hidden" value="kCoKZR1wtX5dTGuvw8p+P0ZsTi3vBEv08IQXh+IOWhM=" /&gt;&lt;/div&gt; &lt;div class="account-wall"&gt; &lt;img class="profile-img" src="../../assets/akpsi_bw_200.png" alt="akpsi_color_200"&gt; &lt;input autofocus="autofocus" class="form-control" id="active_email" name="active[email]" placeholder="Email" type="email" value="" /&gt;&lt;br /&gt; &lt;input autofocus="autofocus" class="form-control" id="active_password" name="active[password]" placeholder="Password" type="password" /&gt; &lt;div&gt;&lt;input name="active[remember_me]" type="hidden" value="0" /&gt;&lt;input id="active_remember_me" name="active[remember_me]" type="checkbox" value="1" /&gt; &lt;label for="active_remember_me"&gt;Remember me&lt;/label&gt;&lt;/div&gt; &lt;input name="commit" type="submit" value="Sign in" /&gt; &lt;/div&gt; &lt;/form&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload