javascript - css轮播图适应布局问题
问题描述

问题解答
回答1:纯靠CSS就可以实现类似效果:
HTML:<body style=’margin: 0;’> <p style=’position: absolute;width: 40%;height: 100%;background-color: blue;overflow: hidden;’><p style=’position: absolute;width: 100%;height: 80%;background-color: orange;top: 10%;left: 200%;’></p><p style=’position: absolute;width: 100%;height: 80%;background-color: green;top: 10%;left: 200%;’></p><p style=’position: absolute;width: 100%;height: 80%;background-color: red;top: 10%;left: 200%;’></p> </p></body>
CSS:.p1{ animation: pleft 6s infinite linear; -webkit-animation: pleft 6s infinite linear; animation-fill-mode: both; -webkit-animation-fill-mode: both;}@keyframes pleft{ 0%{left: 200%} 100%{left: -100%}}.p2{ animation: pmid 6s infinite linear; -webkit-animation: pmid 6s infinite linear; animation-fill-mode: both; -webkit-animation-fill-mode: both; animation-delay:2s; -webkit-animation-delay:2s;}@keyframes pmid{ 0%{left: 200%} 100%{left: -100%}}.p3{ animation: pright 6s infinite linear; -webkit-animation: pright 6s infinite linear; animation-fill-mode: both; -webkit-animation-fill-mode: both; animation-delay:4s; -webkit-animation-delay:4s;}@keyframes pright{ 0%{left: 200%} 100%{left: -100%}}
jsfiddle.net看看是不是你想要的
回答2:想了两种方法: flex 与 inline-block容器设了宽度是为了便于观察.按理来说用定位也是可以的.但是得一个一个设置定位, 就没弄了.
https://jsfiddle.net/m41tLwqb/1/https://jsfiddle.net/2zcqqj26/
回答3:曾用纯CSS做轮播,至于你说的这个,应该能实现,但自己没做过,没法肯定
相关文章:
1. android - WebView加载天猫等购物网页出问题?2. nignx - docker内nginx 80端口被占用3. dockerfile - 为什么docker容器启动不了?4. 垃圾回收 - java 如何手动回收对象5. css - div设置float:left后高度设置自动会无效 ?6. javascript - vue错误提示 Cannot read property ’beforeRouteEnter’ of undefined7. 利用css3 translate来代替传统的修改left和top实现动画,触发webkit的GPU加速渲染功能实现流畅的动画效果8. javascript - typescript关于接口,对象字面量额外属性检测问题,为什么使用断言或者变量时就不会检测额外属性?9. mysql字段保存的字符串含有隐藏字符如何清除10. css - 有没有办法自定义 border 为 dashed 时的虚线间距?

网公网安备