0

enter image description here enter image description here

<div class="form-group">
    <label class="lable label-default"> Google Location</label>
    <input class="form-control" type="text" name='latitude' placeholder="latitude"
                        [(ngModel)]="tourDetails.latitude">
    <input class="form-control" type="text" name='longitude' placeholder="longitude"
                        [(ngModel)]="tourDetails.longitude">
</div>

 My Css code:

label {
  display: inline-block;
  width: 140px;
  text-align: left;
}
input {
    display: inline-block;
    width: 140px;
    text-align: left;
    }

I have my Following Output. But I want to align these input text fields one by one with same proper alignment.

0

2 Answers 2

1

Share your css to properly understand the style, but I am assuming the typo lable instead of label may affect the css rules

<div class="form-group">
    <label class="label label-default"> Google Location</label>
    <input class="form-control" type="text" name='latitude' placeholder="latitude"
                        [(ngModel)]="tourDetails.latitude">
    <input class="form-control" type="text" name='longitude' placeholder="longitude"
                        [(ngModel)]="tourDetails.longitude">
</div>
Sign up to request clarification or add additional context in comments.

3 Comments

label { display: inline-block; width: 140px; text-align: left; } input { display: inline-block; width: 140px; text-align: left; }
create a stackblitz or a codesandbox with the code, cannot debug css without a runtime and working example!
I cannot debug unless I know at which viewport width is this issue happening and the default styles loaded into .form-group that may be cascading your styles
0

I've done only for geo-location. But if like to get the idea of bootstrap, you can refer W3schools or Bootstrap offcial web

The working fiddle Jsfiddle

<div class="container">
   <form class="form-horizontal">
      <div class="row">
         <div class="col-xs-6">
            <label class="control-label label-default"> Google Location</label>
         </div>
         <div class="col-xs-6">
            <div class="form-group">
               <input class="form-control" type="text" name='latitude' placeholder="latitude"
               [(ngModel)]="tourDetails.latitude">
               <input class="form-control" type="text" name='longitude' placeholder="longitude"
               [(ngModel)]="tourDetails.longitude">
            </div>
         </div>
      </div>
   </form>
</div>

Update 1 As you updated the requirement, I've updated the fiddle too. So you can easily remove <div class="row"> and get your expectation

3 Comments

I just want to align the input text fields (above image shows)one by one with proper alignment..It doesn't matter about the label fields.
yeah.. \It works well... But there is no gap between two input fields (latitude and longitude).I need some gap between them.
I have updated the fiddle using input-gap class. But we will appreciate if you try and get your job done, because this community is to encourage coders.

Your Answer

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