Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Custom Radio Buttons

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 520
    Comment on it

    Use of Custom Radio Buttons

    Custom radio buttons are used to style radio buttons by the use of CSS properties by applying background-color and border-color.

    HTML:

    1. <div class="radioButtons ">
    2. <label for="veryurgent">
    3. <input type="radio" value="Very Urgent" name="animal" id="veryurgent">
    4. <span class="circ"><span class="dot"></span></span>
    5. Very Urgent
    6. </label>
    7.  
    8. <label for="Urgent">
    9. <input type="radio" value="Urgent" name="animal" id="Urgent">
    10. <span class="circ"><span class="dot"></span></span>
    11. Urgent
    12. </label>
    13.  
    14. <label for="NotUrgent">
    15. <input type="radio" value="Not so urgent" name="animal" id="NotUrgent">
    16. <span class="circ"><span class="dot"></span></span>
    17. Not so urgent
    18. </label>
    19. </div>

     

    CSS:
     

    1. label {
    2. color: #656565; /* text-color */
    3. font-size: 15px;
    4. font-weight: normal;
    5. padding-left: 0;
    6. padding-right: 0;
    7. text-align: left;
    8. }
    9. label input[type="radio"] {
    10. left: -9001px;
    11. position: absolute;
    12. }
    13. .radioButtons .circ {
    14. border: 2px solid #c7c7c7; /* border color */
    15. border-radius: 50%; /* for circular border */
    16. display: inline-block; /* correctly aligns circular border
    17. height: 20px; /* height of border */
    18. position: relative; /* positions circular dot inside border */
    19. top: 1px;
    20. width: 20px; /* width of border */
    21. }
    22. .radioButtons label input[type="radio"]:checked ~ .circ .dot {
    23. background-color: #5c5e5d;
    24. }
    25. .radioButtons .circ .dot {
    26. border-radius: 50%;/* for circular dot */
    27. height: 10px; /* height of dot */
    28. left: 3px;
    29. position: absolute;/*it makes circular dot visible inside circle */
    30. top: 3px;
    31. width: 10px; /* width of dot */
    32. }

     

     

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: