Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML How to Make a Website Responsive Web Design and Testing Adjust the Profile Page and Header

profile-photo position trouble

I can't get the profile-photo centered when shrinking the browser window size - it wanders to the right side of the header out of the view area. I compared my code and downloaded the project files - but it's all the same. Using Chrome Version 35.0.1916.114 m and Firefox 30.0

4 Answers

Cassio Victor Cadore
Cassio Victor Cadore
6,579 Points

Can you post your code here? Wrap your code with 3 backticks (```) on the line before and after. If you specify the language after the first set of backticks, that'll help us with syntax highlighting.

Hi! Yes and thanks!

@media screen and (min-width: 480px) {

  /**********************************
  TWO COLUMN LAYOUT
  ***********************************/

  #primary {
    width: 50%;
    float: left;
  }

  #secondary {
    width: 40%;
    float: right;

  }

  /**********************************
  PAGE: PORTFOLIO
  ***********************************/ 

  #gallery li {
    width: 28.3333%;
  }

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

  /**********************************
PAGE: PORTFOLIO
***********************************/

  .profile-photo {
    float: left;
    margin: 0 5% 80px 0;
  }

}

@media screen and (min-width: 660px) {

  /**********************************
  HEADER
  ***********************************/

  nav {
    background: none;
    float: right;
    font-size: 1.125em;
    margin-right: 5%;
    text-align: right;
    width: 45%;
  }

  #logo {
    float: left;
    margin-left: 5%;
    text-align: left;
    width: 45%;
  }

  h1 {
    font-size: 2.5em;
  }

  h2 {
    font-size: 0.825em;
    margin-bottom: 20px;
  }

  header {
   border-bottom: 5px solid #599a68; 
  }
}
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Selwyn Rogers | Designer</title>
    <link rel="stylesheet" href="css/normalize.css">
    <link href='http://fonts.googleapis.com/css?family=Changa+One|Open+Sans:400italic,700italic,400,700,800' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="css/main.css">
    <link rel="stylesheet" href="css/responsive.css">
  </head>
  <body>
    <header>
      <a href="index.html" id="logo">
        <h1>Selwyn Rogers</h1>
        <h2>Designer</h2>
      </a>
      <nav>
        <ul>
          <li><a href="index.html">Portfolio</a></li>
          <li><a href="about.html" class="selected">About</a></li>
          <li><a href="contact.html">Contact</a></li>
        </ul>
      </nav>
    </header>
    <div id="wrapper">
      <section>
        <img src="img/me.jpg" alt="Selwyn Rogers" class="profile-photo">
        <h3>About</h3>
        <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</p>
        <p>If you'd like to follow me on Twitter, my username is <a href="http://twitter.com/nickrp">@nickrp</a>.</p>
      </section>
      <footer>
        <a href="http://twitter.com/selloween"><img src="img/twitter-wrap.png" alt="Twitter Logo" class="social-icon"></a>
        <a href="http://facebook.com/selloween"><img src="img/facebook-wrap.png" alt="Facebook Logo" class="social-icon"></a>
        <p>&copy; 2014 Selwyn Rogers.</p>
      </footer>
    </div>
  </body>
</html>
Cassio Victor Cadore
Cassio Victor Cadore
6,579 Points

I'm sorry Selwyn, but I'm having a hard time trying to find where you are. Which track and lesson are you in? This code was taken from a challenge?

hi!

I'm at the frontend-developer track, stage 8.Code is from my workspace. I compared the code with the downloadable project files and it's the same. I'm having the same problem viewing Nick's project files. So i'm guessing this to be a newer browser issue ?