Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap: Make help-block inline

I want the help-block to be inline with the input-field (if there is space available to the right of the input-field), but it is below the input-field no matter how wide the screen is. How can I make it inline?

Here is the form:

  <form class="form-inline" role="form">
    <div class="form-group">
      <label for="query">Search</label>
      <input type="text"
             ng-model="query"
             class="form-control"
             id="query"
             placeholder="Enter search text">
      <span class="help-block">
        Search in any field...
      </span>
    </div>
  </form>

And here is a plunk.

like image 716
EricC Avatar asked Oct 25 '14 18:10

EricC


People also ask

How do you inline a bootstrap element?

Use the d-inline-block class to create a inline-block element. Add breakpoints (sm, md, lg, xl, and xxl) to the classes (d-*-inline-block) to control when the element should be a inline-block element based on the screen width. Resize the browser window to see how it works.

What is D inline-block in bootstrap?

d-inline-block to simply set an element's display property to block , inline , or inline-block (respectively). To make an element display: none , use our responsive utilities instead. Inline. Inline. <div class="d-inline bg-success">Inline</div> <div class="d-inline bg-success">Inline</div>

What is D none in bootstrap?

Hiding elementsTo hide elements simply use the . d-none class or one of the . d-{sm,md,lg,xl,xxl}-none classes for any responsive screen variation. To show an element only on a given interval of screen sizes you can combine one . d-*-none class with a .

How do I create a horizontal form in bootstrap?

Horizontal formCreate horizontal forms with the grid by adding the .row class to form groups and using the .col-*-* classes to specify the width of your labels and controls. Be sure to add .col-form-label to your <label> s as well so they're vertically centered with their associated form controls.


2 Answers

One of the things .help-block does is set display:block. If you don't want that, you can override it like this:

.help-block {
    display: inline;
}

Demo in Plunker

like image 56
KyleMit Avatar answered Sep 22 '22 08:09

KyleMit


/* Make the help displayed horizontally and set with same color with help-block */
.help-inline {
  display: inline;
  color: #737373;
}
like image 21
Carlos Liu Avatar answered Sep 20 '22 08:09

Carlos Liu