How to change the size of the radio button using CSS?

前端 未结 14 1671
野的像风
野的像风 2020-11-28 06:17

Is there a way to control the size of the radio button in CSS ?

14条回答
  •  南方客
    南方客 (楼主)
    2020-11-28 06:52

    try this code... it may be the ans what you exactly looking for

    body, html{
      height: 100%;
      background: #222222;
    }
    
    .container{
      display: block;
      position: relative;
      margin: 40px auto;
      height: auto;
      width: 500px;
      padding: 20px;
    }
    
    h2 {
    	color: #AAAAAA;
    }
    
    .container ul{
      list-style: none;
      margin: 0;
      padding: 0;
    	overflow: auto;
    }
    
    ul li{
      color: #AAAAAA;
      display: block;
      position: relative;
      float: left;
      width: 100%;
      height: 100px;
    	border-bottom: 1px solid #333;
    }
    
    ul li input[type=radio]{
      position: absolute;
      visibility: hidden;
    }
    
    ul li label{
      display: block;
      position: relative;
      font-weight: 300;
      font-size: 1.35em;
      padding: 25px 25px 25px 80px;
      margin: 10px auto;
      height: 30px;
      z-index: 9;
      cursor: pointer;
      -webkit-transition: all 0.25s linear;
    }
    
    ul li:hover label{
    	color: #FFFFFF;
    }
    
    ul li .check{
      display: block;
      position: absolute;
      border: 5px solid #AAAAAA;
      border-radius: 100%;
      height: 25px;
      width: 25px;
      top: 30px;
      left: 20px;
    	z-index: 5;
    	transition: border .25s linear;
    	-webkit-transition: border .25s linear;
    }
    
    ul li:hover .check {
      border: 5px solid #FFFFFF;
    }
    
    ul li .check::before {
      display: block;
      position: absolute;
    	content: '';
      border-radius: 100%;
      height: 15px;
      width: 15px;
      top: 5px;
    	left: 5px;
      margin: auto;
    	transition: background 0.25s linear;
    	-webkit-transition: background 0.25s linear;
    }
    
    input[type=radio]:checked ~ .check {
      border: 5px solid #0DFF92;
    }
    
    input[type=radio]:checked ~ .check::before{
      background: #0DFF92;
    }

提交回复
热议问题