CSS真的很奇特。

发布于:2023-03-25 ⋅ 阅读:(632) ⋅ 点赞:(0)

这是我在冲浪的时候,看到的一个样式,分享给大家,Css真的想象力太丰富了。这个滚动的下划线,还真想不出是背景色做的。

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

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .title {
            width: 800px;
            color: #333;
            line-height: 50px;
        }

        .title span {
            background: linear-gradient(to right, #1890ff, #fa541c)  no-repeat right bottom;
            background-size: 0 4px;
            transition: background-size 1500ms;
        }

        .title span:hover {
            background-position-x: left;
            background-size: 100% 2px;
        }
    </style>
</head>

<body>
    <h2 class="title">
        <span>10年来,中国特色大国外交以元首外交为引领,以推动构建人类命运共同体为主线,应变局,解困局,创新局,
            为维护世界和平、促进共同发展作出了新的贡献。</span>
    </h2>
</body>

</html>

网站公告

今日签到

点亮在社区的每一天
去签到