// 先设置高宽为2倍 然后transform进行变换 使用after实现 对原容器无影响
.thin {
position: relative;
&::after {
position: absolute;
left: 0;
top: 0;
border: 1px solid #f66;
width: 200%;
height: 200%;
content: "";
transform: scale(.5);
transform-origin: left top;
}
}
<a class="tips" href="https://www.baidu.com" data-msg="Hello World">
// 在css的content中可以查询到html中的data-msg
&::after {
position: absolute;
left: 0;
top: 0;
border-radius: 5px;
width: 100%;
height: 100%;
background-color: rgba(#000, .5);
opacity: 0;
text-align: center;
font-size: 12px;
content: attr(data-msg);
transition: all 300ms;
}
// 该属性可以使点击无效 某些特殊时刻可能可以使用
.disabled-trigger {
padding: 0 20px;
border-radius: 10px;
height: 40px;
background-color: #66f;
pointer-events: none;
line-height: 40px;
color: #fff;
}