热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

仅使用CSS交叉淡化多个背景图像-单页设计

如何解决《仅使用CSS交叉淡化多个背景图像-单页设计》经验,为你挑选了1个好方法。

我正在构建一个响应性的单页网站,使用多个div,可以扩展到用户浏览器的高度和宽度.我希望在网站上的一个div中的无限循环中将多个背景图像交叉淡入淡出.我试图尽可能地遵循本教程:http://css3.bradshawenterprises.com/cfimg/,但无法根据我的具体需求进行调整.我相信我错过了教程中的一段代码,这对于这个系统是不可或缺的,但是我不能为我的生活理解我必须使用哪些部分以及为了使这个部分能够在案件.(部分原因在于我的说法,部分原因在于教程被奇怪地分割了.)

我是Web Dev的总菜鸟,所以如果我的代码非常错误,请原谅我(并纠正我).

    
        
html, body { height: 100%; margin: 0; } .panel { font-family: "Source Sans Pro", Helvetica, Arial, sans-serif; color: white; height: 100%; min-width: 100%; text-align: center; display: table; margin: 0; background: #1c1c1c; padding: 0 0; } .panel .inner { display: table-cell; vertical-align: middle; } #backgroundchange.backgroundimg { -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; transition: background-image 1s ease-in-out; } #back1 { background: url(../img/Back1.png) no-repeat center center fixed; } #back2 { background: url(../img/Back2.png) no-repeat center center fixed; } #back3 { background: url(../img/Back3.png) no-repeat center center fixed; } #back4 { background: url(../img/Back4.png) no-repeat center center fixed; } @keyframes cf4FadeInOut { 0% { opacity: 1; } 17% { opacity: 1; } 25% { opacity: 0; } 92% { opacity: 0; } 100% { opacity: 1; } } #backgroundchange div:nth-of-type(1) { animation-delay: 6s; } #backgroundchange div:nth-of-type(2) { animation-delay: 4s; } #backgroundchange div:nth-of-type(3) { animation-delay: 2s; } #backgroundchange div:nth-of-type(4) { animation-delay: 0; }

先感谢您.



1> jmore009..:

我相信这就是你想要的.我不确定你使用的浏览器是什么,但如果它是像chrome这样的webkit浏览器,请确保-webkit-在你的css动画上使用前缀:

HTML

CSS

html, body {
    height: 100%;
    margin: 0;
}

.panel {
    font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;
    color: white;
    height: 100%;
    min-width: 100%;
    text-align: center;
    display: table;
    margin: 0;
    background: #1c1c1c;
    padding: 0 0;
}

.panel .inner {
    display: table-cell;
    vertical-align: middle;
}

.backgroundimg {
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;

}

#back1 {
    background: url("http://www.placecage.com/500/700") no-repeat center fixed;

}

#back2 {
    background: url("http://www.placecage.com/500/600") no-repeat center fixed;
}

#back3 {
    background: url("http://www.placecage.com/500/500") no-repeat center fixed;
}

#back4 {
    background: url("http://www.placecage.com/500/800") no-repeat center fixed;
}

#back5 {
    background: url("http://www.placecage.com/500/900") no-repeat center fixed;
}

@keyframes backgroundchangeFadeInOut {
  0% {
    opacity:1;
  }
  17% {
    opacity:1;
  }
  25% {
    opacity:0;
  }
  92% {
    opacity:0;
  }
  100% {
    opacity:1;
  }
}

@-webkit-keyframes backgroundchangeFadeInOut {
  0% {
    opacity:1;
  }
  17% {
    opacity:1;
  }
  25% {
    opacity:0;
  }
  92% {
    opacity:0;
  }
  100% {
    opacity:1;
  }
}
#backgroundchange div:nth-of-type(1) {
  animation-delay: 8s;
  -webkit-animation-delay: 8s;
}
#backgroundchange div:nth-of-type(2) {
  animation-delay: 6s;
  -webkit-animation-delay: 6s;
}
#backgroundchange div:nth-of-type(3) {
  animation-delay: 4s;
  -webkit-animation-delay: 4s;
}
#backgroundchange div:nth-of-type(4) {
  animation-delay: 2s;
  -webkit-animation-delay: 2s;
}

#backgroundchange div:nth-of-type(5) {
  animation-delay: 0;
  -webkit-animation-delay: 0;
}

#backgroundchange div {
animation-name: backgroundchangeFadeInOut;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
animation-duration: 8s;

-webkit-animation-name: backgroundchangeFadeInOut;
-webkit-animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: infinite;
-webkit-animation-duration: 8s;

}

小提琴


推荐阅读
  • javascript  – 概述在Firefox上无法正常工作
    我试图提出一些自定义大纲,以达到一些Web可访问性建议.但我不能用Firefox制作.这就是它在Chrome上的外观:而那个图标实际上是一个锚点.在Firefox上,它只概述了整个 ... [详细]
  • 如何使用Java获取服务器硬件信息和磁盘负载率
    本文介绍了使用Java编程语言获取服务器硬件信息和磁盘负载率的方法。首先在远程服务器上搭建一个支持服务端语言的HTTP服务,并获取服务器的磁盘信息,并将结果输出。然后在本地使用JS编写一个AJAX脚本,远程请求服务端的程序,得到结果并展示给用户。其中还介绍了如何提取硬盘序列号的方法。 ... [详细]
  • 知识图谱——机器大脑中的知识库
    本文介绍了知识图谱在机器大脑中的应用,以及搜索引擎在知识图谱方面的发展。以谷歌知识图谱为例,说明了知识图谱的智能化特点。通过搜索引擎用户可以获取更加智能化的答案,如搜索关键词"Marie Curie",会得到居里夫人的详细信息以及与之相关的历史人物。知识图谱的出现引起了搜索引擎行业的变革,不仅美国的微软必应,中国的百度、搜狗等搜索引擎公司也纷纷推出了自己的知识图谱。 ... [详细]
  • 本文介绍了南邮ctf-web的writeup,包括签到题和md5 collision。在CTF比赛和渗透测试中,可以通过查看源代码、代码注释、页面隐藏元素、超链接和HTTP响应头部来寻找flag或提示信息。利用PHP弱类型,可以发现md5('QNKCDZO')='0e830400451993494058024219903391'和md5('240610708')='0e462097431906509019562988736854'。 ... [详细]
  • 如何在HTML中获取鼠标的当前位置
    本文介绍了在HTML中获取鼠标当前位置的三种方法,分别是相对于屏幕的位置、相对于窗口的位置以及考虑了页面滚动因素的位置。通过这些方法可以准确获取鼠标的坐标信息。 ... [详细]
  • 本文介绍了响应式页面的概念和实现方式,包括针对不同终端制作特定页面和制作一个页面适应不同终端的显示。分析了两种实现方式的优缺点,提出了选择方案的建议。同时,对于响应式页面的需求和背景进行了讨论,解释了为什么需要响应式页面。 ... [详细]
  • background:-webkit-gradient(linear,10%10%,100%100%, ... [详细]
  • Bootstrapfontnotloadingcorrectlyglyphicons-halflings-regular.woff2.引导字体没有正确加载符号-halflingr ... [详细]
  • 可能我们在看一些网页的源码时会发现自己从来没见过的属性或用法今天我就来总结一下CSS3的冷知识样式计算在CSS中也可以进行简单的计算通过calc函数可以实现这样还可以使我们的 ... [详细]
  • 前端每日实战 2018年10月至2019年6月项目汇总(共 20 个项目)
    过往项目2018年9月份项目汇总(共26个项目)2018年8月份项目汇总(共29个项目)2018年7月份项目汇总(共29个项目)2018年6月份项目汇总(共27个项目)2018年5 ... [详细]
  • 1、给边框加上圆角及阴影,如下代码:<!DOCTYPEhtmlPUBLIC"-W3CDTDHTML4.01TransitionalEN"" ... [详细]
  • http:js.alixixi.coma2014021292298.shtmlhttp:w3cshare.comexample?pid134http:w3cshare.comc ... [详细]
  • 很有意思的全景动画:(直接上代码)html部分:<div><div>css部分:.panorama{width:300px;hei ... [详细]
  • 小编给大家分享一下CSS3如何实现loading预加载动画特效,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章 ... [详细]
  • 这篇文章主要为大家展示了“html5+css3网站菜单的示例分析”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习 ... [详细]
author-avatar
玩玩ftgcriug
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有