zoukankan      html  css  js  c++  java
  • radio 使用css修改默认单选样式

    使用伪元素

    <input class="radio_type" type="radio" name="type" id="radio2" /> 
    <label for="radio2">radio2</label>

    .radio_type{
        width: 20px;
        height: 20px;
        appearance: none;
        position: relative;
    }
    .radio_type:before{
        content: '';
        width: 20px;
        height: 20px;
        border: 1px solid #7d7d7d;
        display: inline-block;
        border-radius: 50%;
        vertical-align: middle;
    }
    .radio_type:checked:before{
        content: '';
        width: 20px;
        height: 20px;
        border: 1px solid #c59c5a;
        background:#c59c5a;
        display: inline-block;
        border-radius: 50%;
        vertical-align: middle;
    }
    .radio_type:checked:after{
        content: '';
        width: 10px;
        height:5px;
        border: 2px solid white;
        border-top: transparent;
        border-right: transparent;
        text-align: center;
        display: block;
        position: absolute;
        top: 6px;
        left:5px;
        vertical-align: middle;
        transform: rotate(-45deg);
    }
     
  • 相关阅读:
    02_类和对象
    Django_数据库增删改查——增
    Django_同步数据库
    Django_models类属性。
    CSS_垂直居中
    CSS_背景属性
    CSS_定位
    CSS_浮动
    CSS_盒子模型
    CSS_元素的分类
  • 原文地址:https://www.cnblogs.com/mcll/p/11433800.html
Copyright © 2011-2022 走看看