Search code examples
htmlcssparallax

Div slide is not dispaying


I am beginning to build a website but each slide on the page does not show. I have my navigation bar showing but all of the divs below it show up blank. Here is my 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>

And my 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;
}

Any help would be much appreciated. I really have no idea what I am doing wrong.


Solution

  • One reason they are not displaying is that you have:

    section {
      opacity: 0;
    }
    

    This makes them invisible.

    Also, the divs are sitting underneath your menu.

    I have made some changes here: https://jsfiddle.net/3hfh47ty/1/