user2312494
user2312494

Reputation: 41

How can I prevent twitter bootstrap's label from breaking new line?

Say I have a text input field and a label. The input appears in a new line right after the label. I need them both to be in the same line. How can I do that with bootstrap?

Upvotes: 4

Views: 6004

Answers (1)

gerrod
gerrod

Reputation: 6627

It depends; are you in a form? You could use a horizontal form:

<form class="form-horizontal">
  <div class="control-group">
    <label class="control-label" for="inputEmail">Email</label>
    <div class="controls">
      <input type="text" id="inputEmail" placeholder="Email">
    </div>
  </div>
  <div class="control-group">
    <label class="control-label" for="inputPassword">Password</label>
    <div class="controls">
      <input type="password" id="inputPassword" placeholder="Password">
    </div>
  </div>
</form>

Alternatively, just using a row class with different span classes should achieve the result you're after:

<div class="row">
    <div class="span3">
        <label for="txtName">Name:</label>
    </div>
    <div class="span9">
        <input type="text" id="txtName" name="Name" />
    </div>
</div>

Upvotes: 3

Related Questions