2021-04-16

这段代码展示了如何创建一个带有紫色背景的焦点图组件。焦点图使用绝对定位实现轮播效果,通过设置`overflow:hidden`隐藏超出部分。左右箭头用于切换图片,圆点作为导航指示当前选中项。该组件还支持鼠标悬停时显示箭头,并通过改变圆点颜色突出当前选中图片。
摘要由CSDN通过智能技术生成
* {
    padding: 0;
    margin: 0;
    list-style: none;
}

.focus {
    position: relative;
    width: 721px;
    height: 455px;
    background-color: purple;
    overflow: hidden;
}

.focus ul {
    position: absolute;
    top: 0;
    left: 0;
    width: 600%;
}

.focus ul li {
    float: left;
}

.arrow-l,
.arrow-r {
    width: 41px;
    height: 69px;
    display:inline-block;
    background-image: url(./upload/icon-slides.png);
    position: absolute;
    top: 50%;
    margin-top: -35px;
    z-index: 2;
    display: none;
}

.arrow-r {
    right: 0;
    background-position: -41px 0;
}

.circle {
    position: absolute;
    bottom: 10px;
    left: 50px;
}

.circle li {
    float: left;
    width: 8px;
    height: 8px;
    /*background-color: #fff;*/
    border: 2px solid rgba(255, 255, 255, 0.5);
    margin: 0 3px;
    border-radius: 50%;
    /*鼠标经过显示小手*/
    cursor: pointer;
}
.current {
    background-color: #fff;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值