Excursions Video or background video?


#1

I'm following instructions on Excursion project to add a video element to the main div and then my h1 and p in the main content container but this is making my text appear below my video instead of laying over it.

Is this a bug in the instructions or am I doing something wrong?

Instructions say: http://screencast.com/t/Mx4DGs5zP

http://screencast.com/t/adjVNexxIRNq

I assume it is supposed to be a background video not just an inserted video element.


#2

Hi James,

Would you mind posting your code? That will make it easier for us to help you :slightly_smiling:
Try giving your text a large z-index (say, 9), and your <video> a small z-index, like maybe 1 (which I think is the default, but making sure it's low won't hurt) :slightly_smiling:


#3

<!DOCTYPE html>
<html>
  <head>
  <link href='https://fonts.googleapis.com/css?family=Open+Sans:300' rel='stylesheet' type='text/css'>
  <link rel='stylesheet' href='style.css'/>
  </head>
  <body>

    <!-- Main section -->
    <div class="main">
      <div class="video-section">
        <video width="100%" autoplay muted loop>
          <source src="https://s3.amazonaws.com/codecademy-content/projects/excursion/bg.mp4" type="video/mp4">
        </video>
      </div>
      <div class="content container">
        <h1>Discover hidden places in the world<br>around you</h1>
        <a href="#" class="btn">Download Excursion</a>
      </div>
    </div>


    <!-- First supporting section -->
    <div class="supporting">
      <div class="container">

      </div>
    </div>


    <!-- Feature section -->
    <div class="feature"></div>


    <!-- Second supporting section -->
    <div class="supporting">
      <div class="container">

      </div>
    </div>


    <!-- Footer -->
    <div class="footer">
      <div class="container">

      </div>
    </div>

  </body>
</html>

CSS

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Open Sans', sans-serif;
}

.container {
  max-width: 940px;
  margin: 0 auto;
}

.main {
  position: relative;
}

.main video {
  width: 100%;
}

.main .content {
  position: absolute;
  top: 200px;
  width: 100%;
  left: 0;
  right: 0;
  margin: 0 auto;
  clear: both;
}

.main h1 {
  font-size: 50px;
  text-shadow: 0 2px 3px rgba(0,0,0,.4);
  color: white;
  text-align: center;
}

.main .btn a {
  background: blue;
}


.supporting {
  margin-top: 100px;
  margin-bottom: 130px;
}

.supporting h2 {
  font-size: 48px;
  font-weight: 300;
}

.supporting p {
  color: #333;
  font-size: 21px;
  font-weight: 300;
  padding: 0 30px;
}

.feature {
  height: 500px;
}

.footer {
  padding: 30px;
}

@media (max-width: 960px) {
  .main {
    height: 540px;
  }
  .main video {
    height: 540px;
    width: 960px;
  }
  .main h1 {
    font-size: 32px;
  }
}

#4

@rubyninja23189 OK, so first: If you have multiple lines of code, please wrap it in triple backticks, not single :slightly_smiling: Like this:

```
<code> will show up here
```

To answer your question,
I'm not sure why it looks the way it does to you in your screenshot. This is what I see with your code:


#5

I had the same issue.
I didn't have the "video-section" div.
Try removing that and it should work.


#7

Could it be the "clear:both" property that you have on the .main . content div? I dont have this and my page looks pretty close to the spec.