CSS+HTML<标签高亮效果>
2020-01-15 本文已影响0人
誰在花里胡哨
效果图:
img.gif这种效果很适合用户扫描二维码时候用,二维码太多,避免用户误扫 👌
image.png
代码如下:
<!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,
html {
height: 100%;
}
body {
margin: 0;
display: flex;
justify-content: center;
align-items: center;
}
.box {
width: 300px;
height: 100px;
position: relative;
box-shadow: 0 0 5px #ccc;
display: flex;
}
.box:hover .block{
opacity: 0.1;
}
.block{
transition: 0.3s;
cursor: pointer;
width: 100px;
height: 100px;
text-align: center;
line-height: 100px;
font-weight: bold;
}
.block:hover{
background: black;
color: white;
opacity: 1 !important;
}
</style>
</head>
<body>
<div class="box">
<div class="block">A</div>
<div class="block">B</div>
<div class="block">C</div>
</div>
</body>
</html>