css样式修改-悬浮数字


代码实现

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>Documenttitle>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        body {
            text-align: center;
        }
        div{
           position: relative;
           width:100px;
           height:100px;
           background:blue;
           margin-top: 10px;
           margin-left: 20px;
           box-shadow: 10px 10px 5px #888888;
        }

        .tip {
            position: absolute;
            min-width: 20px;
            height: 20px;
            background: red;
            box-sizing: border-box;
            color: white;
            font-size: 10px;
            text-align: center;
            line-height: 20px;
            padding: 0 5px;
            border-radius: 10px;
            display: inline-block;
            margin-left: 35px;
            top:-5px;
        }
    style>
head>

<body>
    <div>
        <p class="tip">25p>
    div>
body>

html>

相关