转自:https://blog.csdn.net/qq_36337754/article/details/97240414
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
.msg {
position: relative;
width: 60px;
height: 60px;
margin: 60px;
float:left;
}
.msg img {
width: 60px;
height: 60px;
}
.alarm {
position: absolute;
color: white;
font-size: 17px;
background-color: red;
min-height: 24px;
min-width:24px;
line-height: 24px;
right:-12%;
top: -12px;
text-align: center;
-webkit-border-radius: 24px;
border-radius: 24px;
padding:2px;
}
</style>
</head>
<body>
<div class="msg">
<img src="img/1.png" />
<div class="alarm">
50000
</div>
</div>
</body>
</html>
最后附上,min-height和min-width的使用场景
https://blog.csdn.net/qq_36337754/article/details/97243930
更多精彩内容:各种AI课程、技能课程、黑科技软件、网站小程序源码、副业小项目、PPT模板等精品素材、电商课程、推广引流课程等,尽在 天边资源网 。