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>时间轴</title>
        <meta name="keywords" content="黄河爱浪,WEB前端河浪,jQuery插件开发者河浪,uView-UI河浪">
		<meta name="description" content="QQ:1846492969,邮箱:helang.love@qq.com">
        <style type="text/css">
        body{
            font-size: 14px;
            color: #323232;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
            margin: 0;
            padding: 0;
        }
        .time-line{
            width: 1000px;
            margin: 0 auto;
            list-style: none;
            padding: 0;
        }
        .time-line>li{
            padding: 0;
            margin: 0 0 16px 0;
            overflow: hidden;
        }

        .time-line .item-box{
            width: 50%;
            float: left;
        }

        .time-line .item-box .year{
            border-style: dotted;
            border-width: 0;
            border-color: #ccc;
            font-size: 24px;
            position: relative;

            padding: 58px 48px 28px 0;
            text-align: right;
            border-bottom-width: 3px;
            border-right-width: 3px;
            border-bottom-right-radius: 32px;
        }
        .time-line .item-box .year::after{
            content: '';
            display: block;
            width: 16px;
            height: 16px;
            background-color: #6b8cc7;
            border-radius: 50%;
            position: absolute;
            top: 0;
            right: -9px;
        }
        .time-line .item-box .year::before{
            content: '';
            display: block;
            width: 30%;
            height: 3px;
            background-image: linear-gradient(to right,#fff, rgba(0,0,0,0));
            position: absolute;
            bottom: -3px;
            left: 0;
        }

        .time-line .item-box .content{
            padding: 28px 48px;
            text-align: right;
        }

        .time-line .item-box .year.active{
            color: #6b8cc7;
        }

        /* 右边 */
        .time-line .item-box.right{
            float: right;
        }
        .time-line .item-box.right .year{
            padding: 58px 0 28px 48px;
            text-align: left;
            border-right-width: 0;
            border-left-width: 3px;
            border-bottom-left-radius: 32px;
            border-bottom-right-radius: 0;
        }

        .time-line .item-box.right .year::after{
            right: auto;
            left: -9px;
        }
        .time-line .item-box.right .year::before{
            background-image: linear-gradient(to left,#fff, rgba(0,0,0,0));
            left: auto;
            right: 0;
        }
        .time-line .item-box.right .content{
            text-align: left;
        }
    </style>
    </head>
    <body>
        <h1 style="text-align: center;margin: 0;padding: 50px;">时间轴</h1>
        <ul class="time-line">
            <li>
                <div class="item-box">
                    <div class="year left active">
                        2018
                    </div>
                    <div class="content">
                        <div>成为苏宁体育数据服务商与国内知名体育日报合作</div>
                    </div>
                </div>
            </li>
            
            <li>
                <div class="item-box right">
                    <div class="year left">
                        2019
                    </div>
                    <div class="content">
                        <div>10月,足彩全套数据上线</div>
                    </div>
                </div>
            </li>
            <li>
                <div class="item-box">
                    <div class="year left">
                        2020
                    </div>
                    <div class="content">
                        <div>成为苏宁体育数据服务商与国内知名体育日报合作</div>
                    </div>
                </div>
            </li>
        </ul>
    </body>
</html>

作者:黄河爱浪 QQ:1846492969,邮箱:helang.love@qq.com

公众号:web-7258,本文原创,著作权归作者所有,转载请注明原链接及出处

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值