找回密码
 立即注册
快捷导航

[Html/Css/JS] 有趣的css特效(彩虹渐变字、hover下划线、垂直时间轴)

[复制链接]
NSFW 2023-8-14 08:44:30 | 显示全部楼层
本帖最后由 NSFW 于 2023-8-14 08:47 编辑

彩虹渐变字

 <div class="hover-box">
    <span class="hover-span">悬浮下划线</span>
</div>

<style>
.hover-box {
    position: relative;
    width: 80px;
}
.hover-span {
    cursor: pointer;
}
.hover-span::before {
    display: inline-block;
    position: absolute;
    bottom: -6px;
    content: '';
    height: 4px;
    background: red;
    width: 0;
    transition: width 0.36s;
}

.hover-span:hover::before {
    width: 100%;
}
</style>

hover下划线

 <div class="hover-box">
    <span class="hover-span">悬浮下划线</span>
</div>

<style>
.hover-box {
    position: relative;
    width: 80px;
}
.hover-span {
    cursor: pointer;
}
.hover-span::before {
    display: inline-block;
    position: absolute;
    bottom: -6px;
    content: '';
    height: 4px;
    background: red;
    width: 0;
    transition: width 0.36s;
}

.hover-span:hover::before {
    width: 100%;
}
</style>

垂直时间轴

<div class="time-wrap clearfix">
    <div class="time-left">
        <div class="time-content">111</div>
    </div>
    <div class="time-right">
        <div class="time-content">
            <div>11</div>
            <div>11</div>
            <div>11</div>
            <div>11</div>
            <div>11</div>
            <div>11</div>
        </div>
    </div>
</div>

<style>
.clearfix:after {
    visibility: hidden;
    display: block;
    font-size: 0;
    content: ' ';
    clear: both;
    height: 0;
}

.time-wrap {
    width: 804px;
    height: 700px;
    margin: 0 auto;
}
.time-wrap .time-left,
.time-wrap .time-right {
    position: relative;
    width: 400px;
}
.time-wrap .time-left {
    float: left;
    border-right: 4px solid #b1bbf9;
}
.time-wrap .time-right {
    float: right;
    border-left: 4px solid #b1bbf9;
}
.time-wrap .time-left::before,
.time-wrap .time-right::before {
    position: absolute;
    right: -9px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-block;
    content: '';
    width: 9px;
    height: 10px;
    border: 2px solid #b1bbf9;
    border-radius: 50%;
    background-color: #fff;
}
.time-wrap .time-left::before {
    right: -9px;
}
.time-wrap .time-right::before {
    left: -9px;
}
.time-wrap .time-left::after,
.time-wrap .time-right::after {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: inline-block;
    content: '';
    width: 0;
    height: 0;
}
.time-wrap .time-left::after {
    right: 10px;
    border-top: 10px solid transparent;
    border-left: 12px solid #fff;
    border-bottom: 10px solid transparent;
}
.time-wrap .time-right::after {
    left: 10px;
    border-top: 10px solid transparent;
    border-right: 12px solid #fff;
    border-bottom: 10px solid transparent;
}
.time-wrap .time-left .time-content,
.time-wrap .time-right .time-content {
    box-sizing: border-box;
    padding: 16px;
    border-radius: 12px;
    background-color: #fff;
}
.time-wrap .time-left .time-content {
    margin-right: 20px;
}
.time-wrap .time-right .time-content {
    margin-left: 20px;
}
</style>
回复

使用道具 举报

主题

0

回帖

380

积分

自成一派

东篱 2023-8-14 16:47:57 | 显示全部楼层

彩虹渐变字 2

有趣的css特效(彩虹渐变字、hover下划线、垂直时间轴)6480 作者:东篱 帖子ID:600

 <body>
    <div style="background-color:ffffff;box-shadow:0px 0px 5px #0069ff;padding:0px;margin-top:0px;margin-bottom:1px;">
        <marquee>
            <b id="nr">公告:免费xx,提供稳定,海外速度快等优点,请勿违反道德用途,否则后果自负!</b>
        </marquee>
    </div>
</body>
</html>

<style>
    #nr{
        font-size:20px;
        margin: 0;
        background: -webkit-linear-gradient(left,
        #ffffff,
        #ff0000 6.25%,
        #ff7d00 12.5%,
        #ffff00 18.75%,
        #00ff00 25%,
        #00ffff 31.25%,
        #0000ff 37.5%,
        #ff00ff 43.75%,
        #ffff00 50%,
        #ff0000 56.25%,
        #ff7d00 62.5%,
        #ffff00 68.75%,
        #00ff00 75%,
        #00ffff 81.25%,
        #0000ff 87.5%,
        #ff00ff 93.75%,
        #ffff00 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-size: 200% 100%;
        animation: masked-animation 2s infinite linear;
    }
    @keyframes masked-animation {
        0% {
            background-position: 0 0;
        }
        100% {
            background-position: -100%, 0;
        }
    }
</style>
   
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

1楼
2楼
温馨提示

关于 注册码 问题

      由于近期经常大量注册机器人注册发送大量广告,本站开启免费入群领取注册码注册网站账号,注册码在群公告上贴着...

关于 注册码 问题

      由于近期经常大量注册机器人注册发送大量广告,本站开启免费入群领取注册码注册网站账号,注册码在群公告上贴着...

Archiver|手机版|小黑屋|DLSite

GMT+8, 2024-11-23 01:15

Powered by Discuz! X3.5 and PHP8

快速回复 返回顶部 返回列表