0

I'm trying to align a form but the elements are not aligning, how do you align the text in a form with the checkbox on the next line?

Here's what I see right now: enter image description here

Here's my code:

      <div class="form-group" id="LocationOption">
    <div class="form-check">
      <label class="form-check-label col-md-3">*Been to this location before?</label>

      <input class="form-check-input col-md-1" type="radio" name="Location_sel" id="LocationYes" value="Yes" onclick="location_select(1)">
      <label class="form-check-label col-md-2 text-center" for="LocationYes">Yes</label>

      <input class="form-check-input col-md-1" type="radio" name="Location_sel" id="LocationNo" value="No" onclick="location_select(0)">
      <label class="form-check-label col-md-2 text-center" for="LocationNo">No</label>
    </div>
  </div>

  <div class="form-group">
    <div class="form-check col-md-9">
      <input class="form-check-input" type="checkbox" id="TnC" value="TnC">
      <label class="form-check-label" for="TnC">
        By clicking submit, you agree to our <a class="text-primary" style="cursor: pointer" data-toggle="modal" data-target="#exampleModalLong">Terms and Conditions</a>
      </label>
      <label class="form-check-label text-danger" id="TnCAlert"></label>
    </div>
  </div>
2
  • You need checkbox and label text in 2 different lines? Commented Dec 9, 2020 at 6:36
  • @Master.Deep yes 2 different lines please, just align the left Commented Dec 9, 2020 at 14:42

1 Answer 1

2

Html

<div class="form">
    <div class="form-group" id="LocationOption">
        <div class="form-check">
            <label class="form-check-label col-md-3">*Been to this location before?</label>

            <input class="form-check-input col-md-1" type="radio" name="Location_sel" id="LocationYes" value="Yes"
                onclick="location_select(1)">
            <label class="form-check-label col-md-2 text-center" for="LocationYes">Yes</label>

            <input class="form-check-input col-md-1" type="radio" name="Location_sel" id="LocationNo" value="No"
                onclick="location_select(0)">
            <label class="form-check-label col-md-2 text-center" for="LocationNo">No</label>
        </div>
    </div>

    <div class="form-group">
        <div class="form-check col-md-9">
            <input class="form-check-input" type="checkbox" id="TnC" value="TnC">
            <label class="form-check-label" for="TnC">
                By clicking submit, you agree to our <a class="text-primary" style="cursor: pointer" data-toggle="modal"
                    data-target="#exampleModalLong">Terms and Conditions</a>
            </label>
            <label class="form-check-label text-danger" id="TnCAlert"></label>
        </div>
    </div>
</div>

css

.form{ display:flex; }
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you, but with this I get everything displaying in one line, i'm looking for the "been to this location before" and the terms and conditions line on two different lines but just alligning the left
ooh you can add ml-3 to the checkbox lable class like <label class="form-check-label ml-3" for="TnC">

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.