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 How to Make a Website Responsive Web Design and Testing Adjust the Profile Page and Header

Isabelle Bamber
PLUS
Isabelle Bamber
Courses Plus Student 2,294 Points

header background is too large

Hi, i have managed to get the navigation to float to the right when viewed on desktop. The problem is that my header hasn't reduced in height and the 3 navigations are still lower down on the right as opposed to horiztontally aligned with the logo. How can i fix this? Thanks

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

Hi Isabelle, maybe you can post some code for us so we can try and see what's wrong?

From here, it might be that you need to apply a float to your navigation elements too but I'm speculating, really. :-)

2 Answers

Isabelle Bamber
PLUS
Isabelle Bamber
Courses Plus Student 2,294 Points

Hi Jonathan,

Ok i will try and post the code, its the first time i do this so apologies if its wrong. here is my responsive CSS code. Do you need the html and the CSS main as well? 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: ABOUT
*******************************/  

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

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

/*******************************
PAGE: 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 #027EB2;
    margin-bottom: 60px;
  }

}  
Isabelle Bamber
PLUS
Isabelle Bamber
Courses Plus Student 2,294 Points

Hi Jonathan,

Its ok, i have managed to sort it out after analysing the css. It turns out i needed to add a section in the responsive css under my header section to add 30px at the top of my navigation and 0 elsewhere (instead of 5% margin as the tutorial suggested, i guess a browser issue?). This reduced the header bar in height and aligned my nav to my logo like I wanted it to. I hope this is the right way of solving the issue. Thanks again :)