With Bootstrap 4 and bootswatch, I'd like to place the four Django form fileds, since
(col-sm-2
/textinput), until
(col-sm-2
/textinput), currently_employed
(col-sm-7
/custom checkbox) and form close button(col-sm-1
/a
tag) in-row.
But it rendered wrong like this on the custom checkbox(checkbox is in wrong place):
The codes for above are:
<link href="https://maxcdn.bootstrapcdn.com/bootswatch/4.0.0-beta.3/solar/bootstrap.min.css" rel="stylesheet" integrity="sha384-Jpv9vxZao0dlyvegpeTxSgc5cczNCOpcV5ihm8RQbrMo263QmC3Sf5HIMBfr+nqx" crossorigin="anonymous">
<div class="row-fluid">
<div class="col-sm-1 float-right">
<!-- Empty Career: Close form button -->
<a class="btn btn-default float-right close-career">
<i class="fas fa-times"></i>
</a>
</div>
<div class="col-sm-2 float-left">
<div class="form-group">
<input type="text" name="career-__prefix__-since" class="form-control" placeholder="0000.0" id="id_career-__prefix__-since" />
</div>
</div>
<div class="col-sm-2 float-left">
<div class="form-group">
<input type="text" name="career-__prefix__-until" class="form-control" placeholder="0000.0" id="id_career-__prefix__-until" />
</div>
</div>
<div class="col-sm-7">
<div class="form-group">
<div class="custom-control custom-checkbox">
<input type="checkbox" name="career-__prefix__-currently_employed" class="custom-control-input form-control float-left" id="id_career-__prefix__-currently_employed" />
<label class="custom-control-label" for="id_career-__prefix__-currently_employed">
Currently employed
</label>
</div>
</div>
</div>
since
and until
are float-left
, and close button is float-right
.
To look that correct, I added the class float-left
to currently_employed
, it look good but not clickable:
Changed code for that is:
<link href="https://maxcdn.bootstrapcdn.com/bootswatch/4.0.0-beta.3/solar/bootstrap.min.css" rel="stylesheet" integrity="sha384-Jpv9vxZao0dlyvegpeTxSgc5cczNCOpcV5ihm8RQbrMo263QmC3Sf5HIMBfr+nqx" crossorigin="anonymous">
<div class="row-fluid">
<div class="col-sm-1 float-right">
<!-- Empty Career: Close form button -->
<a class="btn btn-default float-right close-career">
<i class="fas fa-times"></i>
</a>
</div>
<div class="col-sm-2 float-left">
<div class="form-group">
<input type="text" name="career-__prefix__-since" class="form-control" placeholder="0000.0" id="id_career-__prefix__-since" />
</div>
</div>
<div class="col-sm-2 float-left">
<div class="form-group">
<input type="text" name="career-__prefix__-until" class="form-control" placeholder="0000.0" id="id_career-__prefix__-until" />
</div>
</div>
<div class="col-sm-7 float-left">
<div class="form-group">
<div class="custom-control custom-checkbox">
<input type="checkbox" name="career-__prefix__-currently_employed" class="custom-control-input form-control float-left" id="id_career-__prefix__-currently_employed" />
<label class="custom-control-label" for="id_career-__prefix__-currently_employed">
Currently employed
</label>
</div>
</div>
</div>
How could I make it both clickable and look good?