Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7988153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:21:15+00:00 2026-06-04T12:21:15+00:00

Twitter Bootstrap icons are pretty deadly seen here . Look at the bottom right

  • 0

Twitter Bootstrap icons are pretty deadly seen here.

Look at the bottom right hand corner of that section. See that email with an icon prepended? That is what I want to do. I want to make simple_form and boostrap play nicely.

Here’s what I’ve found that will prepend the icon to the input:

= f.input :email, :wrapper => :append do
  = f.input_field :email
  <span class="add-on"><i class="icon-envelope"></i></span>

But it isn’t flush (that could be fixed by changing offsets in CSS) and it’s pretty ugly. For reference, here is the CSS fix (add it to your bootstrap_overrides.css.less file):

.input-prepend .add-on,
.input-append input {
  float: left; }

Does someone know a less hacky way to make simple_form prepend or append an icon with bootstrap?

Update:

The answer below made me have another look at it. HAML usually adds whitespace everywhere, but there is a workaround

Here is an update for the original HAML which removes the whitespaces and doesn’t require the CSS hack:

= f.input :email, :wrapper => :append do
  = f.input_field :email
  %span.add-on>
    %i.icon-envelope

That little greater than (>) makes all the difference. The output HTML has no newlines between the input and the span.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T12:21:17+00:00Added an answer on June 4, 2026 at 12:21 pm

    It’s due to whitespace between the rendered input and span elements. In this case, a line break.

    I am not familiar enough with HAML to tell you how to eliminate the whitespace, but the equivalent ERB would go something like:

    <%= f.input :email, :wrapper => :append do %>
      <%= f.input_field :email %><span class="add-on"><i class="icon-envelope"></i></span>
    <% end %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Twitter Bootstrap has a form control that would glow on the borders when in
Twitter Bootstrap http://twitter.github.com/bootstrap/javascript.html#dropdown has a dropdown.js library (at http://twitter.github.com/bootstrap/1.4.0/bootstrap-dropdown.js )that will change the dropdown
I'm using twitter bootstrap. My problem is that font-sizes in tables are wrong. For
I am using Twitter Bootstrap as Css framework and thinking why waste that space
I use Twitter Bootstrap (not that that matters but it's a third party CSS
I'm using Twitter Bootstrap, and trying to make my links ASP.Net MVC look nice.
I'm using Twitter Bootstrap and some custom css (found here ) to have dropdown
I have a form that uses twitter bootstrap js and css. In my form
I am using Twitter Bootstrap in my rails app. My navbar looks perfect in
According to the twitter bootstrap documentation , I should be able to Wrap strings

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.