css实现DIV扩展伸缩效果,源代码如下:

<!DOCTYPE html>
<html>
<head>
<style type=\'text/css\'>
.expandable .hidden {
  display: none;
}

.expandable:active .hidden, .expandable .hidden:hover {
  display: block;
}

.min {
  width: 50px;
  height: 50px;
  background: green;
  cursor: -moz-zoom-in;
  cursor: -webkit-zoom-in;
}

.full {
  width: 200px;
  height: 200px;
  background: yellow;
  position: relative;
  top: -50px;
}
</style>
</head>
<body>
  <div class=\"expandable\">
    <div class=\"min\"></div>
    <div class=\"hidden full\"></div>
  </div>
</body>
</html>

在线运行

收藏 打印