CSS自适应实现图标右上角消息数字提示 转

转自: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

点赞

发表回复

电子邮件地址不会被公开。必填项已用 * 标注