微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

html – 更改复选框样式以匹配表单中的所有其余样式

我在Fluent Kit框架中使用了这个 login form,在示例中右边第三个,黑色框架.

它错过了一个我不知道如何改变的细节:复选框输入(你可以找到它的文档here,没什么意外,真的),当选中时,它不像框架信息颜色那样注册表单的其余部分,它是主要的.知道我如何改变它,或者我如何为不同的复选框生成样式,所以我不仅可以使用主要的,还可以使用其他复选框?

在这里,我尝试使用codepen中的模板链接重新创建样式:

input[id^="login2"]::-webkit-input-placeholder { color: #444444; }
:-moz-placeholder {
    color: #444444;
    opacity: 1;
}
input[id^="login2"]::-moz-placeholder {
    color: #444444;
    opacity: 1;
}
input[id^="login2"]:-ms-input-placeholder { color: #444444; }
input[id^="login2"]::-ms-input-placeholder { color: #444444; }
input[id^="login2"]::placeholder { color: #444444; }
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://cdn.jsdelivr.net/gh/nespero/fluent-kit@1.3.0/css/fluent-kit.min.css" rel="stylesheet"/>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/nespero/fluent-kit@1.2.0/js/fluent-kit.min.js"></script>

<div class="row">

  <div class="col-xl-4 col-lg-6 col-md-8 py-2">
    <div class="mt-5 mt-md-0 bg-dimgrey text-white shadow-lg">
      <h5 class="py-3 text-center bold bg-darkdimgrey">
        Sign <span class="text-info">in</span>
      </h5>
      <div class="px-3"><hr class="my-0"></div>
      <div class="px-3 pt-3">
        <fieldset>
          <label for="login2-email">Email</label>
          <input id="login2-email" type="email" name="email" placeholder="me@example.com">
        </fieldset>
        <fieldset>
          <label for="login2-password">Password</label>
          <input id="login2-password" type="password" name="password" placeholder="******************" class="input-with-button"/>
          <button class="mi mi-PasswordKeyHide text-info" data-toggle-password-visibility></button>
        </fieldset>
        <div class="d-flex my-2">
          <fieldset>
            <input type="checkBox" id="login2-remember-me" />
            <label for="login2-remember-me">Remember me</label>
          </fieldset>
          <small class="ml-auto"><a class="text-info bold" href="#">Forgot password?</a></small>
        </div>
        <div class="d-flex pb-3 mt-2">
          <small class="d-inline-block py-1">
            Not a member? <a class="text-info bold" href="#">Register</a>
          </small>
          <button class="ml-auto mt-0 btn btn-md btn-rounded btn-info cta">
            Sign in
            <i class="mi mi-ChevronRight"></i>
          </button>
        </div>
        <div class="pb-3 text-center">
          <small class="d-block mb-3">or sign in with</small>
          <div class="pb-3 d-flex justify-content-around">
            <a class="text-white" href="#"><i class="mi mi-facebook"></i></a>
            <a class="text-white" href="#"><i class="mi mi-twitter"></i></a>
            <a class="text-white" href="#"><i class="mi mi-google"></i></a>
            <a class="text-white" href="#"><i class="mi mi-linkedin"></i></a>
          </div>
        </div>
      </div>
    </div>
  </div>
  
</div>

解决方法

添加此样式

input[type=checkBox]#login2-remember-me:checked+label:after {
  background-color: #00B7C3;
}
input[type=checkBox]#login2-remember-me:checked+label:after {
  background-color: #00B7C3;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/gh/nespero/fluent-kit@1.3.0/css/fluent-kit.min.css" rel="stylesheet" />
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/nespero/fluent-kit@1.2.0/js/fluent-kit.min.js"></script>

<div class="row">

  <div class="col-xl-4 col-lg-6 col-md-8 py-2">
    <div class="mt-5 mt-md-0 bg-dimgrey text-white shadow-lg">
      <h5 class="py-3 text-center bold bg-darkdimgrey">
        Sign <span class="text-info">in</span>
      </h5>
      <div class="px-3">
        <hr class="my-0">
      </div>
      <div class="px-3 pt-3">
        <fieldset>
          <label for="login2-email">Email</label>
          <input id="login2-email" type="email" name="email" placeholder="me@example.com">
        </fieldset>
        <fieldset>
          <label for="login2-password">Password</label>
          <input id="login2-password" type="password" name="password" placeholder="******************" class="input-with-button" />
          <button class="mi mi-PasswordKeyHide text-info" data-toggle-password-visibility></button>
        </fieldset>
        <div class="d-flex my-2">
          <fieldset>
            <input type="checkBox" id="login2-remember-me" />
            <label for="login2-remember-me">Remember me</label>
          </fieldset>
          <small class="ml-auto"><a class="text-info bold" href="#">Forgot password?</a></small>
        </div>
        <div class="d-flex pb-3 mt-2">
          <small class="d-inline-block py-1">
            Not a member? <a class="text-info bold" href="#">Register</a>
          </small>
          <button class="ml-auto mt-0 btn btn-md btn-rounded btn-info cta">
            Sign in
            <i class="mi mi-ChevronRight"></i>
          </button>
        </div>
        <div class="pb-3 text-center">
          <small class="d-block mb-3">or sign in with</small>
          <div class="pb-3 d-flex justify-content-around">
            <a class="text-white" href="#"><i class="mi mi-facebook"></i></a>
            <a class="text-white" href="#"><i class="mi mi-twitter"></i></a>
            <a class="text-white" href="#"><i class="mi mi-google"></i></a>
            <a class="text-white" href="#"><i class="mi mi-linkedin"></i></a>
          </div>
        </div>
      </div>
    </div>
  </div>

</div>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐