html - Custom Checkbox is Changing Size -


i creating custom checkboxes. hiding standard checkbox , replacing following:

.newcheckbox:before {   content: "";   display: inline-block;   width: 30px;   height: 30px;   border-radius: 2px;   background-color: rgba(29, 190, 96, 0.1);   border: 1px solid #1dbe60; }  input[type="checkbox"]:checked + .newcheckbox:before {   color: #fff;   background-color: #1dbe60;   content: "\2022";   font-size: 20px;   text-align: center; } 

the issue is, when add 'content', when checkbox in checked state height changes , elements beneath jumping. i've been wracking brain on what's causing this.

here's plunk demonstrating issue: http://plnkr.co/edit/kc7xmgr4nogx0w6pmx9y?p=preview

you can see when remove 'content', doesn't jump around.

add overflow:hidden input[type="checkbox"]:checked

snippet here

/* styles go here */    input[type="checkbox"] {    display: none;  }    .tech-green:before {    content: "";    display: inline-block;    width: 30px;    height: 30px;    border-radius: 2px;    background-color: rgba(29, 190, 96, 0.1);    border: 1px solid #1dbe60;    overflow:hidden;  }    input[type="checkbox"]:checked + .tech-green:before {    color: #fff;    background-color: #1dbe60;    content: "\2022";    font-size: 20px;    text-align: center;    display:inline-block;    overflow:hidden;  }    .tech-warn:before {    content: "";    display: inline-block;    width: 30px;    height: 30px;    border-radius: 2px;    background-color: rgba(240, 147, 29, 0.1);    border: 1px solid #f0931d;  }    input[type="checkbox"]:checked + .tech-warn:before {    color: #fff;    background-color: #f0931d;    content: "\2022";    font-size: 20px;    text-align: center;    display:inline-block;    overflow:hidden;  }
<!doctype html>  <html>    <head>    <link rel="stylesheet" href="style.css">    <script src="script.js"></script>  </head>    <body>    <div>      <input id="techgreen" type="checkbox" name="check">      <label for="techgreen" class="tech-green"></label>    </div>      <div>      <input id="techwarn" type="checkbox" name="check">      <label for="techwarn" class="tech-warn"></label>    </div>      <div>      <input id="techgreen2" type="checkbox" name="check">      <label for="techgreen2" class="tech-green"></label>    </div>  </body>    </html>


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -