鼠标放上显示边框

如下图所示:

<!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>鼠标放上显示外边框颜色</title>
  <style>
  .box {
    margin-top: 200px;
    margin-left: 600px;
  }
    .test {
      width: 100px;
      height: 200px;
      border: 1px solid #ddd;
      float: left;
      margin-left: -1px;  /*清除右边框让其显示一条边框*/
      position: relative;  /*鼠标放上让其定位,相对定位占位置,绝对定位不占位置,后面浮动的div会跑到下面*/
    }
    .test:hover {
      border: 1px solid #e92322;
      cursor: pointer;
      z-index: 1;      
    }
  </style>
</head>
<body>
  <div class="box">
    <div class="test"></div>
    <div class="test"></div>
    <div class="test"></div>
  </div>
</body>
</html>
IT文库 » 鼠标放上显示边框
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址