zoukankan      html  css  js  c++  java
  • radio单选框在项目中应用

    <div class="tags-select">
        <label class="tag-select">
            <input type="radio" name="version" value="1">
            <span class="name">全网通(2GB 16GB)</span>
        </label>
        <label class="tag-select">
            <input type="radio" name="version" value="2">
            <span class="name">全网通(3GB 32GB)</span>
        </label>
        <label class="tag-select">
            <input type="radio" name="version" value="3" disabled>
            <span class="name">联通版(2GB 16GB)</span>
        </label>
    </div>
    .tags-select {
      font-size: 0;
    
      > .tag-select {
        display: inline-block;
        font-size: 14px;
        margin: 5px;
        position: relative;
        font-weight: normal;
    
        .name {
          display: block;
          line-height: 20px;
          padding: 8px 10px;
          border: 1px solid #ccc;
          cursor: pointer;
        }
    
        input[type="radio"] {
          position: absolute;
          opacity: 0;
          z-index: -1;
    
          &:checked + .name {
            border-color: #e3393c;
          }
    
          &:disabled + .name {
            background: #eee;
            color: #999;
            cursor: not-allowed;
          }
        }
      }
    }

    codepen在线示例:https://codepen.io/chendanaliyuntubiao/pen/YzqpxLO

  • 相关阅读:
    LCT 动态树 模板
    [HNOI2010] 物品调度 fsk
    [HNOI2010] 矩阵 matrix
    [HNOI2010] 平面图判定 planar
    [HNOI2010] 公交线路 bus
    [HNOI2017]抛硬币
    [HNOI2010] 弹飞绵羊 bounce
    [HNOI2010] 合唱队 chorus
    [HNOI2017]礼物
    [HNOI2017]大佬
  • 原文地址:https://www.cnblogs.com/hellocd/p/13557942.html
Copyright © 2011-2022 走看看