欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

css -- 布局 盒子加丝带

程序员文章站 2022-05-01 20:17:31
...

效果:

css -- 布局 盒子加丝带

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            position: relative;
            width: 150px;
            height: 150px;
            background-color: #adf;
            margin: 110px auto;
            border-radius: 6px;
            box-sizing: border-box;
            padding: 0 11px 11px;
            overflow: hidden;
        }

        .box p {
            height: calc(100% - 64px);
            overflow: auto;
            font-size: 12px;
            padding: 0 6px;
        }

        .box p::-webkit-scrollbar {
            width: 2px;
            background-color: #adf;
            border-radius: 5px;
        }

        .box p::-webkit-scrollbar-track {
            border-radius: 5px;
        }

        .box p::-webkit-scrollbar-thumb {
            border-radius: 5px;
            background-color: #dfa;
        }

        .mark {
            width: 100%;
            position: absolute;
            top: 11%;
            left: 33%;
            background-color: #EA0A0A;
            color: #ffffff;
            transform: rotate(45deg);
            text-align: center;
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="mark">标签</div>
        <h3>标题</h3>
        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Facere magni atque sunt ea natus labore,
            voluptatibus, rem praesentium laborum aspernatur expedita neque qui saepe quibusdam suscipit, eaque ullam
            tenetur! Assumenda.</p>
    </div>
</body>

</html>
相关标签: HTML.CSS专区 css3