0

I am little bit confused how to use Bootstrap CSS. I have two textboxes, a search button and image side to it. For fullscreen all elements should be in a row.

resizing screen, All elements should be one after another.

<div class="form-group" style="vertical-align: top; margin-right: 20px">
        <label for="name" style="color: #eea236">
            name:</label>
        <input type="text" class="form-control" placeholder="name" name="name" />
    </div>
    <div class="form-group" style="vertical-align: top; margin-right: 20px">
        <label for="organization" style="color: #eea236">
            City:</label>
        <input type="text" class="form-control" placeholder="organization" name="organization" />
    </div>
    
    <button class="btn btn-warning" type="submit" style="vertical-align: top; margin-right: 20px">
        Search</button>
   
   
    <img src="xx.jpg" />

Please help....

7 Answers 7

1
<form class="form-inline">
    <div class="form-group">
        <label for="name">Name:</</label>
        <input type="text" class="form-control" id="name" placeholder="Name">
    </div>
    <div class="form-group">
        <label for="city">City:</</</label>
        <input type="text" class="form-control" id="city" placeholder="City">
    </div>
    <button type="submit" class="btn btn-warning">Search</button>
    <img class="img-responsive" src="xx.jpg" />
</form>
Sign up to request clarification or add additional context in comments.

1 Comment

This is simple inline form code used in bootstrap. getbootstrap.com/css/#forms-inline
0

You could add in display:inline-block on both those form-group div's

<div class="form-group" style="vertical-align: top; margin-right: 20px; display:inline-block;">
        <label for="name" style="color: #eea236">
            name:</label>
        <input type="text" class="form-control" placeholder="name" name="name" />
    </div>
    <div class="form-group" style="vertical-align: top; margin-right: 20px; display:inline-block;">
        <label for="organization" style="color: #eea236">
            City:</label>
        <input type="text" class="form-control" placeholder="organization" name="organization" />
    </div>
    
    <button class="btn btn-warning" type="submit" style="vertical-align: top; margin-right: 20px">
        Search</button>
   
   
    <img src="xx.jpg" />

Comments

0

There is an image responsive class:

you can try adding:

<img class="img-responsive" src="xx.jpg" />

Comments

0

Try adding this to your code display: inline i.e, Replace your top line with this .

<div class="form-group" style="vertical-align: top; margin-right: 20px; display: inline">

Comments

0

You need to use display: inline-block; property.

<div class="form-group" style="display:inline-block; vertical-align: top; margin-right: 20px;">
    <label for="name" style="color: #eea236">
        name:</label>
    <input type="text" class="form-control" placeholder="name" name="name" />
</div>
<div class="form-group" style="display:inline-block; vertical-align: top; margin-right: 20px;">
    <label for="organization" style="color: #eea236">
        City:</label>
    <input type="text" class="form-control" placeholder="organization" name="organization" />
</div>

<button class="btn btn-warning" type="submit" style="vertical-align: top; margin-right: 20px">
    Search</button>


<img src="xx.jpg" />

Comments

0

You don't have to add any inline css. There is a built-in feature in bootstrap that would position the text boxes, buttons, etc. side by side in one row.

Your form should be wrapped in a <form> tag.

<form class="form-inline" role="form">
   *Your form groups here.*
</form>

That should make your form groups display inline, depending on the width of your browser. It should also be responsive as well.

Comments

0
<div class="form-group">
        <label class="col-xs-2 control-label" style="color:eea236">name:/label>
 <div class="col-xs-3"> 
        <input type="text" class="form-control" placeholder="name" name="name"/>
    </div>
<label for="organization" style="color: #eea236">City:</label>
<div class="col-xs-3">  
 <input type="text" class="form-control" placeholder="organization" name="organization" />
</div>
<div class="col-xs-3">
 <button class="btn btn-warning" type="submit">Search</button>
</div> <img src="xx.jpg" />
    </div>

1 Comment

Please edit with more information. Code-only and "try this" answers are discouraged, because they contain no searchable content, and don't explain why someone should "try this". We make an effort here to be a resource for knowledge.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.