html如何给图片加角标

https://segmentfault.com/q/1010000006551803?_ea=1074082

 

 

<html>
<style>
#a1 {
width: 200px;
height: 200px;
background-color: #333;
color: #fff;
position: relative;
margin-top: 50px;
}

#a1:after {
content: attr(data-num);
line-height: 50px;
text-align: center;
width: 50px;
height: 50px;
border-radius: 50%;
background-color: red;
position: absolute;
top: -20px;
right: -20px;
}
</style>
<body>

<div data-num='22' id="a1">33333</div>

</body>
</html>

 

posted on 2018-10-24 16:07  小甜瓜安东泥  阅读(3393)  评论(0编辑  收藏  举报