Div 幻灯片未显示
Div slide is not dispaying
我正在开始建立一个网站,但页面上的每张幻灯片都没有显示。我显示了导航栏,但它下面的所有 div 都显示为空白。这是我的 HTML:
<!DOCTYPE html>
<html>
<head>
<title>Michaela DeForest - Computer Science Student</title>
<link type="text/css" rel="stylesheet" href="css/style.css" />
<script src="http://jarallax.com/download/jarallax-min-0.2.js" type="text/javascript"></script>
<script src="js/animations.js"></script>
</head>
<body onload="init()">
<ul>
<li><a href="#">Michaela DeForest</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Portfolio</a></li>
</ul>
<section id="slide-home">
<div class = "background">
<div class = "container">
<div class="content">
<h1 id = "name">Michaela DeForest</h1>
<h2 id= "title">Computer Science Student at Franklin and Marshall College</h2>
</div>
</div>
</div>
</section>
<section id="slide-about">
<div class= "background">
<div class = "container">
<div class="content">
<h1>About</h1>
<p>I am a junior computer science student at Franklin and Marshall College.</p>
</div>
</div>
</div>
</section>
<section id= "slide-contact">
<div class="background">
<div class = "container">
<div class="content">
<h1>Contact</h1>
<h3>Email: mdefores@fandm.edu</h3>
</div>
</div>
</div>
</section>
<section id = "slide-portfolio">
<div class="background">
<div class = "container">
<div class= "content">
<h1>Portfolio</h1>
</div>
</div>
</div>
</section>
</body>
</html>
还有我的CSS:
@font-face {
font-family:"Dense-Regular";
src: url(../fonts/Dense-Regular.otf);
}
body, html {
height: 100%;
min-height: 100%;
}
section {
border: 1px solid black;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
background-color: #3399ff;
width: 115%;
position: fixed;
z-index: 1;
top: 0;
left: 0;
}
li {
float: left;
}
li a {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-family: "Dense-Regular";
font-size: 40px;
}
li a:hover {
background-color: #007fff
}
section {
min-width: 960px;
opacity: 0;
}
.background {
position: 50% 50%;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
height: 100%;
width: 100%;
}
.container {
width: 100%;
height: 100%;
overflow: hidden;
position: relative;
}
.content {
max-width: 700px;
position: absolute;
left: 50%;
top: 50%;
}
#slide-home .background {
background: url(../images/lightbulb.jpg);
}
#slide-about .background {
background-color: #99ccff;
}
#slide-contact .background {
background-color: #3399ff;
}
#slide-portfolio .background {
background-color: #32dcff;
}
如有任何帮助,我们将不胜感激。我真的不知道我做错了什么。
他们不显示的一个原因是您有:
section {
opacity: 0;
}
这使它们不可见。
此外,div 位于您的菜单下方。
我在这里做了一些修改:
https://jsfiddle.net/3hfh47ty/1/
opacity: 0;
那是你的问题,这意味着不可见
不透明度范围为 0 - 1,增量为 .1,1 表示完全不透明,零表示完全不可见
我正在开始建立一个网站,但页面上的每张幻灯片都没有显示。我显示了导航栏,但它下面的所有 div 都显示为空白。这是我的 HTML:
<!DOCTYPE html>
<html>
<head>
<title>Michaela DeForest - Computer Science Student</title>
<link type="text/css" rel="stylesheet" href="css/style.css" />
<script src="http://jarallax.com/download/jarallax-min-0.2.js" type="text/javascript"></script>
<script src="js/animations.js"></script>
</head>
<body onload="init()">
<ul>
<li><a href="#">Michaela DeForest</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Portfolio</a></li>
</ul>
<section id="slide-home">
<div class = "background">
<div class = "container">
<div class="content">
<h1 id = "name">Michaela DeForest</h1>
<h2 id= "title">Computer Science Student at Franklin and Marshall College</h2>
</div>
</div>
</div>
</section>
<section id="slide-about">
<div class= "background">
<div class = "container">
<div class="content">
<h1>About</h1>
<p>I am a junior computer science student at Franklin and Marshall College.</p>
</div>
</div>
</div>
</section>
<section id= "slide-contact">
<div class="background">
<div class = "container">
<div class="content">
<h1>Contact</h1>
<h3>Email: mdefores@fandm.edu</h3>
</div>
</div>
</div>
</section>
<section id = "slide-portfolio">
<div class="background">
<div class = "container">
<div class= "content">
<h1>Portfolio</h1>
</div>
</div>
</div>
</section>
</body>
</html>
还有我的CSS:
@font-face {
font-family:"Dense-Regular";
src: url(../fonts/Dense-Regular.otf);
}
body, html {
height: 100%;
min-height: 100%;
}
section {
border: 1px solid black;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
background-color: #3399ff;
width: 115%;
position: fixed;
z-index: 1;
top: 0;
left: 0;
}
li {
float: left;
}
li a {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-family: "Dense-Regular";
font-size: 40px;
}
li a:hover {
background-color: #007fff
}
section {
min-width: 960px;
opacity: 0;
}
.background {
position: 50% 50%;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
height: 100%;
width: 100%;
}
.container {
width: 100%;
height: 100%;
overflow: hidden;
position: relative;
}
.content {
max-width: 700px;
position: absolute;
left: 50%;
top: 50%;
}
#slide-home .background {
background: url(../images/lightbulb.jpg);
}
#slide-about .background {
background-color: #99ccff;
}
#slide-contact .background {
background-color: #3399ff;
}
#slide-portfolio .background {
background-color: #32dcff;
}
如有任何帮助,我们将不胜感激。我真的不知道我做错了什么。
他们不显示的一个原因是您有:
section {
opacity: 0;
}
这使它们不可见。
此外,div 位于您的菜单下方。
我在这里做了一些修改: https://jsfiddle.net/3hfh47ty/1/
opacity: 0;
那是你的问题,这意味着不可见
不透明度范围为 0 - 1,增量为 .1,1 表示完全不透明,零表示完全不可见