2017-12-22 7 views
2

Ich bin nicht stark in Frontend-Entwicklung :) Ich benutze Bootstrap für ein Formular erstellt. Aber es sieht nicht gut aus. Wie kann ich mein Eingabeformular in einer Spalte ausrichten?Wie richtet man ein Eingabeformular aus?

<form> 
 
    <div class="form-group form-inline"> 
 
     <label for="exampleInputPrice" class="personal-form-labels">Purchase Price</label> 
 
     <input type="text" class="form-control" id="exampleInputPrice" placeholder="$$$"> 
 
    </div> 
 
    <div class="form-group form-inline"> 
 
     <label for="exampleInputLoan" class="personal-form-labels">Loan Amont</label> 
 
     <input type="text" class="form-control" id="exampleInputLoan" placeholder="$$$"> 
 
    </div> 
 
    <div class="col-md-12 text-center block-buttons"> 
 
     <button type="submit" class="btn btn-primary btn-lg">Continue</button> 
 
    </div> 
 
</form>

enter image description here

+1

[Bearbeiten] (https://stackoverflow.com/posts/47937132/edit) Ihre Frage anstatt Kommentare hinzuzufügen. Welche Bootstrap Version benutzt du? –

+0

Sie können Klasse zur Eingabe hinzufügen und setzen float: richtige Attribut für diese – sauero

+0

@ chade_ Ich habe getan. 4 ver. –

Antwort

2

Verwendung von display:table-*

table { 
 
    border-collapse: separate; 
 
} 
 

 
.form-inline { 
 
    display: table-row; 
 
} 
 

 
.form-inline label, .form-inline input { 
 
    display: table-cell; 
 
    margin: 0 0 5px 10px; 
 
}
<form> 
 
    <div class="form-group form-inline"> 
 
    <label for="exampleInputPrice" class="personal-form-labels">Purchase Price</label> 
 
    <input type="text" class="form-control" id="exampleInputPrice" placeholder="$$$"> 
 
    </div> 
 
    <div class="form-group form-inline"> 
 
    <label for="exampleInputLoan" class="personal-form-labels">Loan Amont</label> 
 
    <input type="text" class="form-control" id="exampleInputLoan" placeholder="$$$"> 
 
    </div> 
 
    <div class="col-md-12 text-center block-buttons"> 
 
    <button type="submit" class="btn btn-primary btn-lg">Continue</button> 
 
    </div> 
 
</form>

+0

Ja! Es ist schön zu arbeiten. Es ist wirklich eine gute Idee. Vielen Dank –

+0

@AndreykinSergey, Sie sind herzlich willkommen! – Ehsan

0

Versuchen Sie, wie diese, Bootstrap Horizontale Form nicht in Bootstrap unterstützen -4 Not supported, verwenden Bootstrap 3

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> 
 

 

 

 

 

 
<form class="form-horizontal" action="/action_page.php"> 
 
    <div class="form-group"> 
 
     <label class="control-label col-sm-2" for="Purchase Price">Purchase Price</label> 
 
     <div class="col-sm-4"> 
 
     <input type="email" class="form-control" id="exampleInputPrice" placeholder="$$$"> 
 
     </div> 
 
    </div> 
 
    <div class="form-group"> 
 
     <label class="control-label col-sm-2" for="Loan Amont">Loan Amont</label> 
 
     <div class="col-sm-4">   
 
     <input type="text" class="form-control" id="exampleInputLoan" placeholder="$$$"> 
 
     </div> 
 
    </div> 
 
    
 
    <div class="form-group">   
 
    <div class="col-sm-offset-2 col-sm-10"> 
 
    <button type="submit" class="btn btn-default">Continue</button> 
 
    </div> 
 
</div> 
 
    </form>

bootsrap-3 doc https://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_form_horizontal&stacked=h

+0

Ich habe es versucht, aber es sieht nicht gut aus in meinem Jumbotron. String ist nicht entgegengesetzt in Zeile –

+0

aktualisiert versuchen Sie dies – core114

0

Wenn Sie boot verwenden Dieses Band 4 Versuchen:

<form> 

    <div class="form-group row"> 
    <label for="exampleInputPrice" class="col-sm-2 col-form-label">Purchase Price</label> 
    <div class="col-sm-10"> 
     <input type="text" class="form-control" id="exampleInputPrice" placeholder="$$$"> 
    </div> 
    </div> 

    <div class="form-group row"> 
    <label for="exampleInputLoan" class="col-sm-2 col-form-label">Loan Amont</label> 
    <div class="col-sm-10"> 
     <input type="text" class="form-control" id="exampleInputLoan" placeholder="$$$"> 
    </div> 
    </div> 

    <div class="form-group form-inline"> 
     <button type="submit" class="btn btn-primary btn-lg">Continue</button> 
    </div> 
</form> 

https://jsfiddle.net/sv2j08dd/3/

0
Modulation: Glasstärke:

css: .inputs umspannen {display: inline-block; Breite: 60%; Auffüllen: 0 0 15px 0; } .inputs Spanneneingabe {Breite: 30%; schweben: links; höhe: 25px; padding: 0 5px;}

.inputs {breite: 100%; float: links; padding: 0 25px; Box-Sizing: border-box;}

.inputs label {width: 20%; float: left;}

Verwandte Themen