Broadway exercise help!


#1

Hello, I am doing the Broadway exercise, and everything is well except for the fact that I can't get my header floating on top of my background image. How could I solve this? Any help appreciated.

HTML:

<!DOCTYPE html>
<html>
  <head>
    <link href='https://fonts.googleapis.com/css?family=Raleway:400, 600' rel='stylesheet' type='text/css'>
  <link rel='stylesheet' href='style.css'/>
  </head>
  <body>
    <div class="header">
      <div class="container">
        <ul class="nav">
          
            <li> About </li>
             <li> Work </li>
             <li> Team </li>
             <li> Contact </li>
          

        </ul>
      </div>
    </div>

    <div class="jumbotron">
      <div class="container">  
        <div class="main">
          <h1>We are Broadway</h1>
          <a href="#" class="btn-main"> Get Started </a>
          

          
          <img src="http://s3.amazonaws.com/codecademy-content/projects/broadway/bg.jpg" alt="foto">
          
        </div>
      </div>
    </div>

    <div class="supporting">
      <div class="container">
        
        
        
        <div class="col">
          <img src="https://s3.amazonaws.com/codecademy-content/projects/broadway/design.svg">
          <h2>Design</h2>
          <p>Make your projects look great and interact beautifully.</p>
          
          <a href="#"> Learn More </a>
          
          
          
        </div>
        <div class="col">
          <img src="https://s3.amazonaws.com/codecademy-content/projects/broadway/develop.svg">
          <h2>Develop</h2>
          <p>Use modern tools to turn your design into a web site</p>
          
          <a href="#"> Learn More </a>
          
        </div>
        <div class="col">
          <img src="https://s3.amazonaws.com/codecademy-content/projects/broadway/deploy.svg">
          <h2>Deploy</h2>
          <p>Use modern tools to turn your design into a web site</p>
          
          <a href="#"> Learn More </a>
          
        </div>
      </div>
      <div class="clearfix"></div>
    </div>

    <div class="footer">
      <div class="container">
        <p>&copy; Broadway 2015</p>
      </div>
    </div>
  </body>
</html>

Css:

img {width: 100%;
  height:100%;
  
 
    -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
  background-image: cover;
}

.img {
  height: 800px;
  background: url(http://s3.amazonaws.com/codecademy-content/projects/broadway/bg.jpg);
  background-size: cover;
}


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

.jumbotron {
  height: 800px;
}

.nav {
  margin: 0;
  padding: 20px 0;
}

.nav li {
  color: #fff;
  font-family: 'Raleway', sans-serif;
  font-weight: 600;
  font-size: 12px;
}

.main {
  position: relative;
  top: 180px;
  text-align: center;
}

.main h1 {
  color: #333;
  font-family: 'Raleway', sans-serif;
  font-weight: 600;
  font-size: 70px;
  margin-top: 0;
  margin-bottom: 80px;
  text-transform: uppercase;
}

.btn-main {
  background-color: #333;
  color: #fff;
  font-family: 'Raleway', sans-serif;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 1.3px;
  padding: 16px 40px;
  text-decoration: none;
  text-transform: uppercase;
}

.supporting {
  padding-top: 80px;
  padding-bottom: 100px;
}

.supporting .col {
  float: left;
  width: 33%;
  font-family: 'Raleway', sans-serif;
  text-align: center;
}

.supporting img {
  height: 32px;
}

.supporting h2 {
  font-weight: 600;
  font-size: 23px;
  text-transform: uppercase;
}

.supporting p {
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  padding: 0 50px;
  margin-bottom: 40px;
}

.clearfix {
  clear: both;
}

.footer {
  background-color: #333;
  color: #fff;
  padding: 30px 0;
}

.footer p {
  font-family: 'Raleway', sans-serif;
  text-transform: uppercase;
  font-size: 11px;
}

@media (max-width: 500px) {
  .main h1 {
    font-size: 50px;
    padding: 0 40px;
  }

  .supporting .col {
    width: 100%;
  }
}

#2

Hey,

So firstly, you've added the <img> within the html so it's randomly appearing floating in your DOM..

I'd recommend using CSS to assign the image as a background-image rather than adding the<img> within your HTML..

.jumbotron {
  height: 800px;
  background-image: url(http://s3.amazonaws.com/codecademy-content/projects/broadway/bg.jpg);
   -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

Here you can see I've used CSS' background-image property and assigned it to the .jumbotron class

Secondly, I'd suggest removing the <img> tag from your HTML and respective img{} CSS :smiley:

Hope this helps


#3

I had same problem with floating image.
When it comes to my case, I haven't fully understood concept of container and jumbotron.

If you're not used to put url of img as background into jumbotron on css, I recommend you to read about them(container, jumbotron) and play with them.

I got stuck from latter project, then I came back to first one.
Good luck with your project!