Sunday 3 March 2019

Switch button using pure css outer custom text

/////////////////////////css

  .switch-btn
        {
            positionrelative;
            displayinline-block;
                margin-left50px;
                width88px;
            height20px;
        }
       
        .switch-btn .switch input
        {
            displaynone;
        }
       
        .switch-btn .slider
        {
            positionabsolute;
            cursorpointer;
            top0;
            left0;
            right0;
            bottom0;
            background-color#ca2222;
            -webkit-transition.4s;
            transition.4s;
        }
       
        .switch-btn .slider:before
        {
            positionabsolute;
            content"";
            height28px;
            width28px;
            left1px;
            bottom-4px;
            background-colorwhite;
            -webkit-transition.4s;
            transition.4s;
            bordersolid 0.5px #ddd;
        }
       
        .switch-btn input:checked + .slider
        {
            background-color#2ab934;
        }
       
        .switch-btn input:focus + .slider
        {
            box-shadow0 0 1px #2196F3;
        }
       
        .switch-btn input:checked + .slider:before
        {
            -webkit-transformtranslateX(55px);
            -ms-transformtranslateX(55px);
            transformtranslateX(55px);
        }
       
        /*------ ADDED CSS ---------*/
       
       
        .switch-btn .on.off
        {
            color#000;
            positionabsolute;
            transformtranslate(-50%,-50%);
            top50%;
            left50%;
                font-size0.9rem;
            font-familyVerdana, sans-serif;
        }
        .switch-btn .on
        {
            /*display: none;*/
            color:#ddd;
            left-1.2rem;
        }
         .switch-btn .off
        {
            left6rem;
            width1px;
            color:#000;
        }
        .switch-btn input:checked + .slider .on
        {
          /*  display: block;*/
          color:#000;
        }
       
        .switch-btn input:checked + .slider .off
        {
            color:#ddd;
          /*  display: none;*/
        }
       
        /*--------- END --------*/
       
        /* Rounded sliders */
        .switch-btn .slider.round
        {
            border-radius34px;
        }
       
        .switch-btn .slider.round:before
        {
            border-radius50%;
        }



/////////////////////////html


<label class="switch-btn ">
        <input type="checkbox" id="togBtn">
        <div class="slider round">
            <span class="on">On</span> <span class="off">Off</span>
        </div>

    </label>



/////////////////Result


       


No comments:

Post a Comment

Excel Sort values in ascending order using function TEXTJOIN

 Excel ::  Text ::  1,3,5,2,9,5,11 Result :: 1,2,3,5,5,9,11 Formula ::     TEXTJOIN ( ",",1,SORT(MID(SUBSTITUTE( A1 ,","...