html Evan Lovely的CodePen。自定义复选框和收音机表单元素 - 使用CSS3使复选框和收音机看起来很漂亮:)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html Evan Lovely的CodePen。自定义复选框和收音机表单元素 - 使用CSS3使复选框和收音机看起来很漂亮:)相关的知识,希望对你有一定的参考价值。

@import "compass";
input[type='checkbox'],
input[type='radio'] {
  position: relative;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 0;
  background: white;
  border: solid 1px #ccc;
  @include border-radius(2px);
  -webkit-box-shadow:inset 0 0 4px rgba(0,0,0,0.19);
  -webkit-transition: all .3s linear;
  .lt-ie9 & {
    background: transparent;
    width: auto;
    height: auto;
  }
  &:hover {
    border-width: 2px;
    border-color: #a5b800;
  }
  &:after {
    -webkit-transition: all .3s linear;
    opacity: 0;
    content: '';
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
  }
  &:active {
    background: rgba(255, 255, 255, 0.1);
    outline:none;
    &:after {opacity:.3;}
  }
  &:focus {
    outline: none;
  }
  &:checked {
    &:after {opacity: 1;}
    &:active:after {opacity: .3;}
  }
}
input[type='checkbox'] {
  &:after {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAYAAAAmL5yKAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJ bWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdp bj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6 eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0 NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJo dHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1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BTAYyfIthnPY99ybvvvkG7Lf+Aw9WAwNOBsRmZ2Fi mBSsJScjwPEV3ZXgMGjeeefE2osvzEECrMyMDAG64kfh0QWKex91Py8t0c3YwggeiIXrrz/cf/ut HLqCTBu5yelWcnm4AhklFtJWXnl/6uEHARgfaOv1Nh91LXyxhGLAl59/mFJXXvl2/cUXdj0p3m+L YvS5CSYSkAHI+N3XXyxZq668BtHoctgwQIABAEdi1ERnXXX0AAAAAElFTkSuQmCC"); 
    $w: 16px;
    $h: 14px;
    width: $w;
    height: $h;
    margin-left: -1 * ($w / 2);
    margin-top: -1 * ($h / 2);
  }
}
input[type='radio'] {
  @include border-radius(11px);
  &:after {
    $size:12px;
    background: #2f89c3;
    width: $size;
    height: $size;
    @include border-radius($size / 2);
    margin-left: -1 * ($size / 2);
    margin-top: -1 * ($size / 2);
  }
}
<input type="checkbox"><br />
<input type="checkbox" checked="true">
  <hr />
<input type="radio" name="radio"><br />
<input type="radio" name="radio" checked="true>

以上是关于html Evan Lovely的CodePen。自定义复选框和收音机表单元素 - 使用CSS3使复选框和收音机看起来很漂亮:)的主要内容,如果未能解决你的问题,请参考以下文章

B. Lovely Palindromes1000 / 构造 找规律

CodeForces 688B - Lovely Palindromes(思路)

PM修炼·敏捷开发IBM Evan Leybourn谈敏捷约束理论。

html CodePen快捷方式

html 来自https://codepen.io/pen/

YouTube 播放列表在单个页面上嵌入多个播放列表的脚本 (jQuery/CSS/HTML + CodePen)