mardi 24 janvier 2017

center a check/tick within a custom check box

I am building a custom check box, the functionality is almost there but the styling has a way to go.

I have a few problems,

  1. I need the check centered within the circle
  2. I only need the check to be active on click of the checkbox itself not the text to.

Im afraid i cant seem to center the check without using padding left of position left.

HTML

<label for='product-45-45'>
  <input type='checkbox' style="float:left;" id='product-45-45' />
  <div class="accord-text">
    <strong>header:</strong> sub text
    <strong>more text!</strong>
  </div>
</label>

CSS

input[type=checkbox] {
  display: none;
}

input[type=checkbox] + .accord-text:before {
  width: 30px;
  height: 30px;
  border-radius: 200%;
  background-color: #d6e4ec;
  border: 1px solid #000;
  display: block;
  font-size: 150%;
  font-weight: 900;
  content: "";
  color: green;
}

input[type=checkbox]:checked + .accord-text:before {
  display: table;
  content: "\2713";
}




Aucun commentaire:

Enregistrer un commentaire