css 如何更改输入[type=“checkbox”]边框颜色

wj8zmpe1  于 2022-12-15  发布在  其他
关注(0)|答案(2)|浏览(226)
.contests input[type="checkbox"]{
   background: #fff;
   margin-right: 10px;
   border: 1px solid #fff;
   width: 1rem;
}
.contests input[type="checkbox"]{
    background: #fff;
    margin-right: 10px;
    border: 1px solid #fff;
    width: 1rem;
}

我想更改边框颜色复选框如何更改此选项

r7knjye2

r7knjye21#

你必须使用这样的轮廓样式

.contests input[type="checkbox"]{
     outline-style: solid;
     outline-color: red;
}
fwzugrvs

fwzugrvs2#

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
        .form-group input {
        padding: 0;
        height: initial;
        width: initial;
        margin-bottom: 0;
        display: none;
        cursor: pointer;
        }
        .form-group label {
        position: relative;
        cursor: pointer;
        }
        .form-group label: before {
        content:'';
        -WebKit-appearance: none;
        background-color: transparent;
        border: 2px solid #0079bf;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0px -15px 10px -12px 
        rgba(0, 0, 0, 0.05);
        padding: 10px;
        display: inline-block;
        position: relative;
        vertical-align: middle;
        cursor: pointer;
        margin-right: 5px;
        }
        .form-group input:checked + label:after {
        content: '';
        display: block;
        position: absolute;
        top: 2px;
        left: 9px;
        width: 6px;
        height: 14px;
        border: solid #0079bf;
        border-width: 0 2px 2px 0;
        transform: rotate(45deg);
        }
    </style>
  </head>
  <body>
    
    <div class="new">
        <form>
          <div class="form-group">
            <input type="checkbox" id="html">
            <label for="html">HTML</label>
          </div>
        </form>
      </div>
  </body>
</html>

相关问题