Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Image width problem.

I dont know why, but i cant make the image with the id "shampoo-photo" fill the entire width of the site.

here is the html:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="..\css\normalize.css">
    <link href="https://fonts.googleapis.com/css?family=Audiowide|BioRhyme|Black+Ops+One|Bungee|Bungee+Shade|Creepster|Ewert|Fruktur|Gravitas+One|Monoton|Rubik:900" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="..\css\main.css">
    <title>Delux | shampoo</title>
  </head>
  <body>
    <header>
      <a href="index.html" id="logo">
        <h1>Delux shampoo</h1>
        <h2>the best.</h2>
      </a>
        <nav>
          <ul>
          <li><a href="index.html">Home</a></li>
          <li><a href="about.html" id="selected">About</a></li>
          <li><a href="contact.html">Contact</a></li>
        </ul>
      </nav>
    </header>
    <section id="section-header">
      <img src="..\images\shampoo.jpg" id="shampoo-photo">
    </section>
    <div id="wrapper">
      <section>

      </section>

      <footer>
        <a href="@IbrahimTheDev"><img src="..\images\twitter.png" alt="twitter-logo" class="footerimg"></a>
        <a href="https://www.facebook.com/ibrahim.crauf.5"><img src="..\images\facebook.png" alt="facebook-logo" class="footerimg"></a>
        <p>&#64;2017 Ibrahim Warsame.</p>
      </footer>
    </div>
  </body>
</html>

here is the css code:

/**********************************
GENERAL THINGS AND MORE STUFF.
**********************************/

body, #gallery { margin-top: 0; }

#wrapper {
  max-width: 940px;
  margin: 0 auto;
  padding: 0 5%;
}

li {
  list-style: none;
}

img {
  max-width: 100%;
}

a {
  text-decoration:none;
}
/**********************************
STYLING THE HEADER.
**********************************/

header {
  float: left;
  margin: 0 0 30px 0; 
  padding: 5px 0 0 0;
  width: 100%;
}

header{
  text-align: center;
}

header {
  background-color:green;
}

#logo{
  color: white;
  margin:0
}

#logo h1 {
  font-family: 'audiowide', cursive;
    font-weight: normal;
    color: #ededed;
}

#logo h2 {
  font-family: 'Black Ops One', cursive;
    font-weight: normal;
    margin-bottom: 10px;
  color: #ededed;
}
header {
  margin-top: -17px;

}
/**********************************
STYLING THE NAVIGATION BAR.
**********************************/

nav ul {
  list-style:none;
  margin:0 10px;
  padding:5px;

}

nav li {
  display:inline-block;

}

nav {
    text-align: center;
    padding: 10px 0;
    margin: 20px 0 0;
  background-color:#05c405; 
}

nav a {
  font-weight: 800;
  font-family: Arial;
  padding: 15px 10px;
  color: #ededed;
}
/**STYLING THE IMAGE GALLERY.**/
#gallery li {
  float: left;
  max-width: 45%;
  padding: 2.5%;
  color: #bdc3c7;
}

#selected {
  color: black;
}
/**********************************
 STYLING: THE GALLERY.
**********************************/

#gallery li a p {
  margin: 0;
  padding: 5%;
  font-size: 0.75em;
   background-color: #f5f5f5;
  color: #bdc3c7;
}

#gallery li:nth-child(3n)  {
            clear: left;
    }

#gallery li:nth-child(5n)  {
            float: right;
    }

#gallery img {
  height: 200px;
}
/**********************************
STYLING THE FOOTER.
**********************************/

footer {
        font-size: 20px;
        text-align: center;
        padding-top: 50px;
        clear: both;
}
.footerimg {
  height: 40px;
  width: 40px;
  margin: 0 5px;
}

/**********************************
STYLING THE ABOUT PAGE.
**********************************/

#section-header {
  width: 100%;
}

#shampoo-photo {
  max-width: 100%;
  max-width: 100%;
}

1 Answer

Hi Ibrahim

Try this :

#shampoo-photo {
  width: 100%;
}