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 Adding Pages to a Website Style New Pages

When creating my about page my profile-photo is stuck to the very bottom of the navigation, there is no gap/margin?

this is my main.css:

a{
    text-decoration: none;
}

a{
    color: #fff;
}

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

#logo{
    margin: 0;
    text-align: center;
}

header{
    background: #1F3324;
    border-color: #3D6647;
}

h1, h2{
    color: #fff;
}

nav{
    background: #3D6647;
}

nav a, nav a:visited: #fff;

nav a.selected, nav a:hover{
    color: #99FFB2;
}

body{
    background-color: #fff;
    color: #5C996B;
}

h1{
    font-family: '', sans-serif;
    font-size: 2em;
    font-weight: normal;
    line-height: 0.8em;
    margin: 15px 0;
}

h2{
    font-size: 0.75em;
    font-weight: normal;
    margin: -5px 0 0;
}

nav{
    text-align: center;
    margin: 20px 0 0;
    padding: 10px 0;
}

body{
    font-family: '', sans-serif;
}

footer{
    text-align: center;
    padding-top: 50px;
    font-size: 0.75em;
    color: #99FFB2;
    clear: both;
}

img{
    max-width: 100%;
}

#gallery{
    list-style: none;
    margin: 0;
    padding: 0;
}

#gallery li{
    float: left;
    width:45%;
    margin: 2.5%;
    background-color: #3D6647;
    color: #5C996B;
}



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

.profile-photo{
    padding: 0px 0 0 0;
     display: block;
    border-radius: 100%;
    max-width: 150px;
    margin: 0 auto 30px 0;
}


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

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

nav li{ 
    display: inline-block;
}

nav a{
    font-weight: 800;
    padding:15px 10px;
}

.social-icon{
    height: 20px;
    width: 20px;
    margin: 0 5px;
}

4 Answers

Thank you to everyone that tried to solved this issue, I have now corrected it. The error was in the about.html code. I had placed the id="logo" in the <header> tag and not in the <a href="index.html"> tag below that.

This happened because of my efforts to code the whole thing from memory on a daily basis so I can one day do without referring back to the videos.

The error therefore lay not in the code that I had posted to you all.

Thank you none the less and please stay curious and keep up the good work.

Boris Vukobrat
Boris Vukobrat
4,248 Points

You shouldn't post entire file, really. Remove padding attribute from .profile-photo selector. Remove last 0 from margin attribute. When you solve your problem, check this post as solved. Have a nice day :).

Unfortunately this has failed to solve the issue. Removing the final 0 from margin only centres the image and i want to create distance from the navigation border.

Thank you for trying.

Boris Vukobrat
Boris Vukobrat
4,248 Points

I tried your css code, and image is offset from nav border. So there is nothing in css that moves your image up to the navigation bar. You can always add some margin at the top of image (margin: 20px auto 30px;), but this doesn't give us an answer why at your browser doesn't appear a gap.

Khaleel Hamid
Khaleel Hamid
5,258 Points

You have a space under .profile-photo, which could be the problem.

Display: block isn't aligned with the others.

Also I have mine like this

.profile-photo {
  display: block;
  max-width: 150px;
  margin: 0 auto 30px;
  border-radius: 100%;
}

Remove the padding. I don't know how far your in that course, but Nick removes it eventually.

Thank you for trying but this has had no impact of the issue

Khaleel Hamid
Khaleel Hamid
5,258 Points

Did you try it with removing the padding.

sorry yes i tried with removing the padding. I added padding just to play around and see if it worked and although adding padding to the top did work it ate into the image and distorted it. Adding margin to the top had no impact.

Thank you for your input.