角标

<!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>html,body {width: 100%;height: 100%;display: flex;}div {position: relative;width: 200px;height: 64px;line-height: 64px;text-align: center;margin: auto;font-size: 24px;background: #03a9f4;color: #fff;border-radius: 32px;}div::before {content: attr(count);position: absolute;right: 10px;top: -8px;border-radius: 12px;padding: 0 8px;background: deeppink;font: 16px/1.5 sans-serif;transform: translate(50%, 0);}</style></head><body><div><div count="角标提示">Message</div></div></body></html>
图片标识

<!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>
</head>
<style>
body {
padding: 20px;
}
.g-wrap {
position: absolute;
cursor: pointer;
}
img {
position: relative;
width: 300px;
}
[desc1]::before,
[desc2]::after {
position: absolute;
padding: 4px 10px 4px 20px;
font-size: 12px;
color: #333;
z-index: 10;
opacity: 0;
transition: all .5s;
}
[desc1]::before {
content: attr(desc1);
right: 2%;
top: 10%;
background:
radial-gradient(10px at 12% 50%, #333 0%, #333 2.5px, transparent 2.5px),
linear-gradient(135deg, transparent 7px, #fff 7px, #fff 100%) top left,
linear-gradient(45deg, transparent 7px, #fff 7px, #fff 100%) bottom left;
background-size: 100% 100%, 100% 50%, 100% 50%;
background-position: 0 0, 0 0, 0 100%;
background-repeat: no-repeat;
transform: translate(30px, 0);
}
[desc2]::after {
content: attr(desc2);
left: 8%;
bottom: 20%;
padding: 4px 20px 4px 10px;
background:
radial-gradient(10px at 88% 50%, #333 0%, #333 2.5px, transparent 2.5px),
linear-gradient(-135deg, transparent 7px, #fff 7px, #fff 100%) top left,
linear-gradient(-45deg, transparent 7px, #fff 7px, #fff 100%) bottom left;
background-size: 100% 100%, 100% 50%, 100% 50%;
background-position: 0 0, 0 0, 0 100%;
background-repeat: no-repeat;
transition-delay: .2s;
transform: translate(-30px, 0);
}
[desc1]:hover::before,
[desc2]:hover::after {
opacity: 1;
transform: translate(0px, 0);
}
</style>
<body>
<div class="g-wrap" desc1="商品描述AAA" desc2="商品描述BBB">
<img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1560086901480&di=3633d2d532f21a13d43e30aaf5db2a66&imgtype=0&src=http%3A%2F%2Fimg.94477.com%2F3206%2F1684912%2F5.jpg"
alt="">
</div>
</body>
</html>
html向css传值
