Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Radio box, label text to the right in CSS

How do i move the text to the right side of a radio box even tho its more than one line?

Like this :
Example

Html looking like this:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

<label for="confirm_box" class="label_radio">
<input class="radio_check" type="radio" name="confirm_box" />
Yes, sign me up for the Newsletter. I confirm I am over 16 years old. I agree to
Privacy Policy <a href="#">here.</a>
</label>

>Solution :

move the input out of the label and wrap them with a container that uses Flexbox. To have the input at the top instead of the vertical center, you can use align-self: flex-start on the input. To space them apart you can use the gap-property.

.d-flex {
  display: flex;
  gap: 5px;
}

.d-flex input {
  align-self: flex-start;
}
<div class="d-flex">
  <input class="radio_check" type="radio" name="confirm_box" />
  <label for="confirm_box" class="label_radio">
    Yes, sign me up for the Newsletter. I confirm I am over 16 years old. I agree to
Privacy Policy <a href="#">here.</a>
  </label>
</div>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading