Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trouble with content overlapping horizontal form using responsive Twitter Bootstrap

I have spent more time than I ever care to admit trying to fix this stupid bug. I have a form that displays to the left of some content. It looks okay on a wide and narrow screen, but on a tablet width (it overlays between 770 and 950 or so) the content to the right overlaps the form fields.

Am I missing something in my markup to use Twitter Bootstrap properly or do I need to add some custom styles using breakpoints to fix it? It appears that the fixed pixel width is causing the issue defined in bootstrap.css. Shouldn't these width properties use % since I'm using a fluid responsive layout? enter image description here

<div class="container-narrow">
  <div class="content">
    <div class="row-fluid">
      <div class="span5">
        <form class="form-horizontal" id="applies-Step1-form" action="/" method="post">
          <div class="control-group">
            <label class="control-label required" for="Step1_email">Email <span class="required">*</span></label>
            <div class="controls">
              <input size="60" maxlength="255" name="Step1[email]" id="Step1_email" type="text" />
            </div>
          </div>

          <div class="control-group">
            <label class="control-label required" for="Step1_home_zip">Home Zip <span class="required">*</span></label>
            <div class="controls">
              <input size="5" maxlength="5" name="Step1[home_zip]" id="Step1_home_zip" type="text" />
            </div>
          </div>
        </form>
      </div>

      <div class="span7">
        <div class="promo-btm">
          <h2>Heading 2</h2>
          <ul class="checks">
            <li>Bullet One</li>
            <li>Bullet Two</li>
          </ul>
        </div>
      </div>
    </div>
  </div>
</div>

See the attached screenshot for the bug or you can reproduce it yourself using my fiddle.

If someone could help point out a way to fix this I would be extremely appreciative!

like image 976
Cofey Avatar asked Jan 17 '13 23:01

Cofey


People also ask

Is twitter bootstrap responsive?

With Bootstrap 2, we've gone fully responsive. Our components are scaled according to a range of resolutions and devices to provide a consistent experience, no matter what.

Why you should not use Bootstrap?

Anti-patterns. First off, Bootstrap supports far too many anti-patterns. An anti-pattern is a design idea that seem good, is reproduced often, but generally are bad ideas for a website. First off, Bootstrap does not give you a truly responsive design.

Is Bootstrap heavy?

Bootstrap sites can be heavy So, if you use this popular front-end UI library in your project, make sure you pay extra attention to page weight and page speed.


1 Answers

Just add a width to your input elements so they can adapt responsively with all of your screen sizes. You can use something like .span12 as a width on your input elements and that should fix the issue:

HTML

<div class="container-narrow">
  <div class="content">
    <div class="row-fluid">
      <div class="span5">
        <form class="form-horizontal" id="applies-Step1-form" action="/" method="post">
          <div class="control-group">
            <label class="control-label required" for="Step1_email">Email <span class="required">*</span></label>
            <div class="controls">
              <input class="span12" size="60" maxlength="255" name="Step1[email]" id="Step1_email" type="text" />
            </div>
          </div>

          <div class="control-group">
            <label class="control-label required" for="Step1_home_zip">Home Zip <span class="required">*</span></label>
            <div class="controls">
              <input class="span12" size="5" maxlength="5" name="Step1[home_zip]" id="Step1_home_zip" type="text" />
            </div>
          </div>
        </form>
      </div>

      <div class="span7">
        <h2>Heading 2</h2>
        <ul class="checks">
          <li>Bullet One</li>
        </ul>
      </div>
    </div>
  </div>
</div>

Demo: http://jsfiddle.net/yR7Ap/18/

like image 56
Andres Ilich Avatar answered Sep 21 '22 03:09

Andres Ilich