I have a problem with Bootstrap 4 radio and checkboxes custom styles.
I want to recreate:
I managed to change the background but I cannot change the style when the radio or checkbox is pressed. I have no experience with data SVG that can be pasted, I saw in some forums that you can do that also.
Also, I have tried to add my own image as an SVG file to my css background-image: url() but is not recognized.
Bellow code for HTML and CSS
.custom-control-label::before {
background-color: #f1f2ec;
border: 2px solid #678000;
height: 21px;
width: 21px;
border-radius: 22px;
box-sizing: border-box;
}
/* This is the checked state */
.custom-radio .custom-control-input:checked~.custom-control-label::before,
.custom-radio .custom-control-input:checked~.custom-control-label::after {
/* background-color: #678000; */
/* border: 2px solid #678000; */
/* this bg image SVG is just a white circle, you can replace it with any valid SVG code */
background-image: url("/images/radio-pressed.svg");
border-radius: 50%;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<!-- Radio -->
<div class="col-6 pt-5">
<form>
<div class="custom-control custom-radio">
<input type="radio" class="custom-control-input" id="radioBtn2">
<label for="radioBtn2" class="custom-control-label"></label>
</div>
</form>
</div>
<!-- Checkbox -->
<div class="col-6 pt-5 pb-5">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="customCheck1">
<label class="custom-control-label" for="customCheck1">Check this custom checkbox</label>
</div>
</div>
I saw also some demos online but they don't really help me. Any help would be appreciated!