在网页中贴入一张不规则的图片,然后通过选取不同的rgb值给这张图片填充不同的颜色,图片如图:
模拟了一下
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
<style>
#content{
padding: 0;
margin: 0;
height: 150px;
width: 150px;
overflow: hidden;
position: relative;
}
img:hover{
padding: 0;
margin: 0;
top: -91px;
position: absolute;
-webkit-filter: drop-shadow(0px 91px 0px tomato);
filter: drop-shadow(0px 91px 0px tomato);
}
img:active{
padding: 0;
margin: 0;
top: -91px;
position: absolute;
-webkit-filter: drop-shadow(0px 91px 0px blue);
filter: drop-shadow(0px 91px 0px blue);
}
</style>
</head>
<body>
<div id="content">
<img src="https://img-ask.csdn.net/upload/201707/07/1499422649_973182.png" alt="这是一张衣领的图片" style="max-width:100%;">
</div>
</body>
</html>
不可能吧,你要是svg或是canvas可以