How To Create a Custom Checkbox CSS

styling checkboxes css tricks
styling checkboxes css tricks
styling checkboxes css tricks

In this article we will learn how to create custome checkbox css, here i will provide two types of Checkbox CSS and we will learn Styling Checkbox CSS.

  • Circle Checkbox CSS
  • Retangle Checkbox CSS

Circle Checkbox CSS

HTML AND CSS

<style type="text/css">

   .container
   {
	   width:100%;
	   padding:40px;
	   height:200px;
	   background:#FF9;
   }
   
  

   .container-checkbox {
    display: block;
    position: relative;
    padding-left: 35px;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 18px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

    .container-checkbox input {
        position: absolute;
        opacity: 0;
        cursor: pointer;
    }

    .container-checkbox .checkmark {
        position: absolute;
        top: 0px;
        left: 0;
        height: 25px;
        width: 25px;
        border-radius: 100%;
        background-color: #e34000;
    }

    .container-checkbox:hover input ~ .checkmark {
        background-color: #ff5e1e;
    }

    .container-checkbox input:checked ~ .checkmark {
        background-color: #a63508;
    }

    .container-checkbox .checkmark:after {
        content: "";
        position: absolute;
        display: none;
    }


    .container-checkbox input:checked ~ .checkmark:after {
        display: block;
    }

    .container-checkbox .checkmark:after {
        left: 10px;
        top: 5px;
        width: 5px;
        height: 10px;
        border: solid #fff;
        border-width: 0 3px 3px 0;
        -webkit-transform: rotate(45deg);
        -ms-transform: rotate(45deg);
        transform: rotate(45deg);
    }

</style>


<div class="container">
        <h1>Checkbox css style examples</h1><br />
        <label class="container-checkbox">Apple
           <input  type="checkbox">
           <span for="checkbox12" class="checkmark"></span>
       </label>
       
       <label class="container-checkbox">Banana
           <input  type="checkbox">
           <span for="checkbox12" class="checkmark"></span>
       </label>
       
       <label class="container-checkbox">Pineapple
           <input  type="checkbox">
           <span for="checkbox12" class="checkmark"></span>
       </label>
                  
</div>

Retangle Checkbox CSS

HTML AND CSS

<style type="text/css">

   .container
   {
	   width:100%;
	   padding:40px;
	   height:200px;
	   background:#FF9;
   }
   
  

   .container-checkbox {
    display: block;
    position: relative;
    padding-left: 35px;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 18px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

    .container-checkbox input {
        position: absolute;
        opacity: 0;
        cursor: pointer;
    }

    .container-checkbox .checkmark {
        position: absolute;
        top: 0px;
        left: 0;
        height: 25px;
        width: 25px;
        background-color: #e34000;
    }

    .container-checkbox:hover input ~ .checkmark {
        background-color: #ff5e1e;
    }

    .container-checkbox input:checked ~ .checkmark {
        background-color: #a63508;
    }

    .container-checkbox .checkmark:after {
        content: "";
        position: absolute;
        display: none;
    }


    .container-checkbox input:checked ~ .checkmark:after {
        display: block;
    }

    .container-checkbox .checkmark:after {
        left: 10px;
        top: 5px;
        width: 5px;
        height: 10px;
        border: solid #fff;
        border-width: 0 3px 3px 0;
        -webkit-transform: rotate(45deg);
        -ms-transform: rotate(45deg);
        transform: rotate(45deg);
    }

</style>


<div class="container">
        <h1>Checkbox css style examples</h1><br />
        <label class="container-checkbox">Apple
           <input  type="checkbox">
           <span for="checkbox12" class="checkmark"></span>
       </label>
       
       <label class="container-checkbox">Banana
           <input  type="checkbox">
           <span for="checkbox12" class="checkmark"></span>
       </label>
       
       <label class="container-checkbox">Pineapple
           <input  type="checkbox">
           <span for="checkbox12" class="checkmark"></span>
       </label>
                  
</div>

Leave a Reply

avatar
  Subscribe  
Notify of