css-通过css让块显示或隐藏

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    .box {
      width: 200px;
      height: 200px;
      background: yellow;
      cursor: pointer;
      position: relative;
    }
    .box1{
      width: 116px;
      height: 133px;
      background: pink;
      display: none;
      position: absolute;
      top: 130px;
      right: -16px;
    }
    .box:hover .box1 {
      display: block;
    }
  </style>
</head>
<body>
  <div class="box">
    <div class="box1">1213</div>
  </div>
</body>
</html>

 

posted @ 2018-05-10 11:02  年少的你如此美丽  阅读(303)  评论(0编辑  收藏  举报