题目
使用HTML+CSS实现如图布局,border-width:5px,格子大小是50px*50px,hover时
边框变成红色,需要考虑语义化。
解答
利用 flex 布局完成此次小练习
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style>
.main{
background:blue;
width:180px;
height:180px;
display:flex;
flex-wrap:wrap;
}
.div{
background:white;
opacity:0.8;
width:50px;
height:50px;
border:solid 5px blue;
text-align:center;
}
.div:hover{
border:solid 5px red;
}
</style>
</head>
<body>
<div class = "main">
<div class = "div">1</div>
<div class = "div">2</div>
<div class = "div">3</div>
<div class = "div">4</div>
<div class = "div">5</div>
<div class = "div">6</div>
<div class = "div">7</div>
<div class = "div">8</div>
<div class = "div">9</div>
</div>
</body>
</html>