Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap 4: Checkbox text on the left, checkbox on the right

It seems simple, but I can't seem to figure it out. I have a checkbox with text, and I need the text to stand on the left, checkbox on the right. How can I do this?

Here's my code:

.custom-control-description {
  color: #009fff;
  text-transform: uppercase;
}
.custom-checkbox .custom-control-indicator {
  border-radius: 0;
  border: 2px solid #cdc9ca;
  background: #fff;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<form>
<div class="checkbox-wrap d-flex justify-content-end p-2 mb-2">
  <label class="custom-control custom-checkbox">
    <span class="custom-control-description">All Pages</span>
  <input type="checkbox" class="custom-control-input">
    <span class="custom-control-indicator"></span>
</label>
</div>
</form>
like image 595
Retros Avatar asked Dec 22 '25 12:12

Retros


1 Answers

Add position attribute to the styling of custom-control-indicator.

 .custom-checkbox .custom-control-indicator {
    position: relative;
    border-radius: 0;
    border: 2px solid #cdc9ca;
    background: #fff;
 }
like image 57
Vipul Singh Avatar answered Dec 24 '25 02:12

Vipul Singh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!