实现九宫格,且鼠标移入的时候仅边框变色
<!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>
body, div {
margin: 0;
padding: 0;
}
.container {
margin: 10px auto;
width: 154px;
height: 154px;
font-size: 0px;
}
.box a {
position: relative;
display: inline-block;
width: 50px;
height: 50px;
border: 1px solid #888;
margin-left: -1px;
margin-top: -1px;
text-align: center;
line-height: 50px;
font-size: 14px;
z-index: 1;
}
.box a:hover {
border-color:red;
z-index: 2;
}
</style>
</head>
<body>
<div class="container">
<div class="box">
<a href="">1</a>
<a href="">2</a>
<a href="">3</a>
<a href="">4</a>
<a href="">5</a>
<a href="">6</a>
<a href="">7</a>
<a href="">8</a>
<a href="">9</a>
</div>
</div>
<div class="parsent">
<a href="" class="child">1</a>
<a href="" class="child">2</a>
<a href="" class="child">3</a>
</div>
<script src="demo.js"></script>
</body>
</html>
网友评论