首页htmlappearanceCSS Property Value - 如何创建纯CSS图像切换

CSS Property Value - 如何创建纯CSS图像切换

我们想知道如何创建纯CSS图像切换。

<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
input[type="checkbox"] {
  content: url('http://placehold.it/200x200');
  display: block;
  width: 200px;
  height: 200px;
}

input[type="checkbox"]:checked {
  content: url('http://placehold.it/210x210');
}

.native-hidden {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}
</style>
</head>
<body>
  <input class="native-hidden" type="checkbox" />
  Click image to see the change
</body>
</html>