img

基于bootstrap的面板选中效果

2020-05-23 0条评论 2.7k次阅读 CSS


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet">
<style>
  body {
    margin: 0;
  }
  button, input, optgroup, select, textarea {
    color: inherit;
    font: inherit;
    margin: 0;
    padding: 0;
    -webkit-appearance: none;
    -webkit-font-smoothing: inherit;
    border: none;
    background: rgba(0, 0, 0, 0);
    line-height: normal;
  }
  .content-box-spacing:first-child, .content-box:first-child {
    margin-top: 0;
  }
  .content-box {
    border-radius: 4px;
    background: #fff;
    color: #737373;
  }
  .content-box, .content-box-spacing {
    margin-top: 1em;
  }
  .content-box {
    -webkit-box-shadow: 0 0 0 1px #d9d9d9;
    box-shadow: 0 0 0 1px #d9d9d9;
  }
  .content-box__row:first-child {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    border-top: none;
  }
  .content-box__row {
    height: 45px;
    border-top: 1px solid #d9d9d9;
    padding:0 12px;
    zoom: 1;
    display: flex;
    align-items: center;
    overflow: hidden;
    *zoom: 1;
  }
  .content-box__row:after, .content-box__row:before {
    content: "";
    display: table;
  }
  .checkbox-wrapper:after, .checkbox-wrapper:before, .radio-wrapper:after, .radio-wrapper:before {
    content: "";
    display: table;
  }
  .checkbox__input, .radio__input {
    padding-right: 0.75em;
    white-space: nowrap;
  }
  .checkbox__input, .radio__input .input-radio{
  }
  .content-box .input-checkbox, .content-box .input-radio {
    border-color: #d9d9d9;
  }
  .input-checkbox:checked, .input-radio:checked {
    border: none;
    -webkit-box-shadow: 0 0 0 10px #046c58 inset;
    box-shadow: inset 0 0 0 10px #046c58;
  }
  .input-radio {
    border-radius: 50%;
  }
  .input-checkbox, .input-radio {
    width: 18px;
    height: 18px;
    -webkit-box-shadow: 0 0 0 0 #bbb inset;
    box-shadow: inset 0 0 0 0 #bbb;
    -webkit-transition: all 0.2s ease-in-out;
    -o-transition: all 0.2s ease-in-out;
    transition: all 0.2s ease-in-out;
    position: relative;
    cursor: pointer;
    vertical-align: -4px;
    outline: 0;
    border: 1px solid;
  }

  .input-checkbox:checked:after, .input-radio:checked:after {
    -webkit-transform: scale(1);
    -ms-transform: scale(1);
    transform: scale(1);
    opacity: 1;
    filter: alpha(opacity=100);
  }
  .input-radio:after {
    width: 4px;
    height: 4px;
    margin-left: -2px;
    margin-top: -2px;
    background-color: #fff;
    border-radius: 50%;
  }
  .input-checkbox:after, .input-radio:after {
    content: "";
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    -webkit-transform: scale(0.2);
    -ms-transform: scale(0.2);
    transform: scale(0.2);
    -webkit-transition: all 0.2s ease-in-out 0.1s;
    -o-transition: all 0.2s ease-in-out 0.1s;
    transition: all 0.2s ease-in-out 0.1s;
    opacity: 0;
    filter: alpha(opacity=0);
  }
  .content-box .radio__label {
    margin-bottom: 0;
    font-size: 16px;
  }
  .content-box .field__input, .content-box .radio__label {
    color: #333;
  }
  .content-box__emphasis {
    font-weight: 500;
    color: #333;
    width: 100%;
  }
  .content-box__emphasis .express_name{
    font-weight: bold;
  }
    .content-box__emphasis .content-box__price {
      float: right;
      display: block;
    }
  .checkbox__label, .radio__label {
    cursor: pointer;
    vertical-align: middle;
  }
  .content-box__desc {
    font-size: 14px;
  }
  .content-box__row[disabled],.content-box__row[disabled] .content-box__desc {
    opacity: .6;
  }
</style>
<body>
<div class="panel panel-collapse">
  <div class="content-box">
    <div class="radio-wrapper content-box__row" disabled>
      <div class="radio__input">
        <input class="input-radio" disabled style="outline: none;" type="radio" value="true" name="checkout[billing_same_as_shipping]" id="tracked_shipping">
      </div>
      <label for="tracked_shipping" class="radio__label content-box__emphasis">
        <div class="content-box__desc">
             <span>
               <span class="express_name">Tracked Shipping</span> / <span>26-35 business days</span>
             </span>
             <span class="content-box__price">$ 9.91</span>
        </div>
      </label>
    </div>
    <div class="radio-wrapper content-box__row">
      <div class="radio__input">
        <input class="input-radio" style="outline: none;" type="radio" name="checkout[billing_same_as_shipping]"  checked="checked" value="false" id="priority_shipping">
      </div>
      <label for="priority_shipping" class="radio__label content-box__emphasis">
          <div class="content-box__desc">
             <span>
               <span class="express_name">Priority Shipping</span> / <span>22-26 business days</span>
             </span>
             <span class="content-box__price">$ 9.91</span>
        </div>
      </label>
    </div>
    <div class="radio-wrapper content-box__row">
      <div class="radio__input">
        <input class="input-radio" style="outline: none;" type="radio" name="checkout[billing_same_as_shipping]" value="false" id="express_shipping">
      </div>
      <label for="express_shipping" class="radio__label content-box__emphasis">
         <div class="content-box__desc">
             <span>
                 <span class="express_name">Express Shipping</span> / <span>22-26 business days</span>
             </span>
             <span class="content-box__price">$ 9.91</span>
        </div>
      </label>
    </div>
  </div>
</div>


</div>
</body>
</html>

💬 COMMENT


🦄 支持markdown语法

👋友