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

Scarf Pablo
Scarf Pablo
1,994 Points

My photo on the about page is not centered and is not seen on the page. it is all the way right to the header. why? help

<!DOCTYPE html>
<html>
    <head> 
        <meta charset="utf-8">
        <title> Nicholas Piva | Programmer  </title>
        <link rel="stylesheet" href="css/normalize.css">
        <link href='http://fonts.googleapis.com/css?family=Bree+Serif|Hammersmith+One' rel='stylesheet' type='text/css'>
        <link rel="stylesheet" href="css/main.css">
    </head>
    <body>  
        <header>
            <a href="index.html" id="logo">
                <h1> Nicholas Piva </h1> 
                <h2> Programmer </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" class="profile-photo" alt="Photograph of Nicholas Piva">
                <h3> About </h3>
                <p> Hi I am Nicholas Piva! This is my main website and it serves as my main online presence. When I am not programming I enjoy readings, calisthenics, and playing ping pong and more. </p>
                <p> If you would like to follow me on Twitter, my username is <a href="https://twitter.com/NicholasJPiva"> @nicholasjpiva</a>. 
                </p>

            </section>
        <footer>
            <a href="https://www.facebook.com/nicholasjpiva"> <img src="img/twitter-wrap.png" class="social-icon"  alt="Twitter Logo"></a>
            <a href="https://twitter.com/NicholasJPiva"><img src="img/facebook-wrap.png" class="social-icon"  alt="Facebook Logo"></a>

            <p> &copy; 2014 Nicholas Piva. </p> 
        </footer>
    </div>

    </body>
    </html>
/**************************************************
GENERAL
***************************************************/

a {
    text-decoration: none;
}

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

img {
    max-width:100%;
}

h3 {
    margin:0 0 1em 0;
}

/**************************************************
Heading
***************************************************/
header {
    float:left;
    margin: 0 0 30px 0;
    padding: 5px 0 0 0;
    width:100%;
}
#logo {
    text-align: center;
    margin:0;
}


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



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

/**************************************************
Navigation
***************************************************/

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

}

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

nav li {
    display:inline-block;
}

nav a {
    font-weight:800;
    padding:15px 10px;
}
/**************************************************
Page: Portfolio
***************************************************/

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

}


#gallery li {
    float:left;
    width:45%;
    margin:2.5%;
    background-color:#F5f5f5;
    color:#bdc3c7;
}

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





/**************************************************
Footer
***************************************************/


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

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


/**************************************************
Page: About
***************************************************/

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



/**************************************************
Colors
***************************************************/



body {
    background-color:white;
    color:#999;
}



header {
    background: #6ab47b;
    border-color:#599a68;
}



h1, h2 {
    color:white;
}



a {
    color:#6ab47b;
}



nav {
    background:#599a68;
}



nav a, nav a:visited {
    color:#fff;
}



nav a.selected, a.hover {
    color:#32673f;
}
Blake Provenza
Blake Provenza
Courses Plus Student 3,461 Points

Your Css and your Html seem to be in order, the only thing I can think of is that the size of the image that you imported may bee too large, for this example I would try and keep it around 200 x 200.

I tweaked your Markdown a bit to add syntax highlighting. :)

Scarf Pablo
Scarf Pablo
1,994 Points

I am using the photo of Nick that he gave us and it still doesn't work. This is the weirdest thing

Scarf Pablo
Scarf Pablo
1,994 Points

I am using the photo of Nick that he gave us and it still doesn't work. This is the weirdest thing

Blake Provenza
Blake Provenza
Courses Plus Student 3,461 Points

I have entered the exact code that is posted above, and it seems to work for me!

The only other thing I can think of is that the browser you are using is the problem. What browser are you using?

I have tested it as well, and it seems to work like you want it to. Can you give us a screenshot of what you're seeing? Also, what browser are you using?

Scarf Pablo
Scarf Pablo
1,994 Points

That is the weirdest thing! I am always using firefox, it is my default browser (which it doesn't work). But I just used chrome to open it up and it works?? That is bazarr! anyone have any idea on why that is?

I just tried it in Firefox, and it seems to work there...you're right, that is weird.

5 Answers

I dont know where exactly the teacher notes are but if your code is exactly like as follows below it will work. You must add clear: both; to the class.

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

Matt Adkisson
Matt Adkisson
4,035 Points

I was having this same problem using Firefox and simply adding

clear: both;

fixed the issue. It was driving me crazy. Thank you so much.

Blake Provenza
PLUS
Blake Provenza
Courses Plus Student 3,461 Points

The only thing I can really think of is that some browsers, in the case of missing or problematic CSS, will replace it with their own as a sort of failsafe to messed up code.

Besides that I definitely recommend Chrome from now on out it is a lot more developer friendly!

It appears to me, in encountering a similar problem, that the Firefox browser does interpret things a bit differently. (Oh, figured I should also mention that I'm working in a Linux Ubuntu environment, not Windows or Apple Mac.) When I coded the display as "inline-block" instead of "block" the image appeared and stays left. Responding to the comment immediately above this, although it's a bit of an aside, Chrome may behave better in terms of the coding for this particular assignment, but I'll stick to the open-source Mozilla Firefox as my default browser, rather than the proprietary Google Chrome, thank you very much! Yes, the display will ultimately need to work in both, (as well as other browsers, such as the disgusting Internet Explorer) and learning to make those adjustments will have to be a part of the task of coding in the future. It's just the way things will have to be, in an imperfect world.

I'm honestly not sure what's causing the problem Nicholas seems to be experiencing. I doubt it's Firefox, as I tried his code out in a CodePen in both the dev and stable releases, and both display it just fine, centered as it should be. Same in Chrome and Safari.

Also, I believe that inline-block will always stick left, even with margin: 0 auto; applied to it. Very useful for small-scale UI components, like half of what Bootstrap makes.

Hi, Ryan, I'm a long way from any sort of expertise in this stuff. My previous education/experience was coding with Dreamweaver, some basic hand-coding with Notepad, and a little bit with Komodo Edit, (which is what I'm using now) under Windows 7 on the basis of a 1-year community college certificate in Web Development & Design, and is outdated by about 2 1/2 years, which was when my husband died unexpectedly and my life blew up. I've been delighted with the opportunity Code Oregon has provided for me to catch up and get current. I jumped in on this thread because when I coded this assignment as directed, I had the same thing happen with the profile picture disappearing when the CSS was applied. Trying out various things, I found the "inline-block" display mode at least brought the picture back. I just thought that the fact that I'm using the Firefox browser on a machine running Linux Ubuntu Trusty Tahr (which has had issues of its own) might have something to do with why MY site was behaving the way it was. (And, might generalize to others? I don't know what OS Nicholas is using, of course, not being psychic.) I'm still learning my way around Linux, so there's a lot I don't know about the different ways it works as compared to a machine running Windows. (I have a little bit of experience with Macs, from school, but not all that much, so I won't attempt to address that aspect of things.) I'm pretty determined about trying to figure things out on my own, so I'll wrestle with an issue for some time before I'll break down and ask for help. I've already noticed, too, that sometimes the security software I'm running can affect things in unexpected ways, so there's that, as well. Just thought I'd add this information to the mix, in case it suggests anything to you in the way of a solution to what Nicholas (and myself?) are experiencing here. Thank you for the quick response! Hopefully, an understanding of what's happening can be achieved with enough minds with diverse experience being applied to the situation. (We could run it by Support and see what they say?) Crap, and now the link images on the "contact" page won't show up, either! I give up. (For the time being, anyway.) Okay, partial surrender--I can get them to show up fine in the Komodo Edit version of the assignment, but not in Workspaces here. I do think the Linux isn't communicating well on the uploads of the image files. So, probably, the page isn't "finding" the images. Not sure how to fix that/find the right path. Doesn't seem to be the same problem with the security software blocking things, as I was having & discussed with Support before., or shouldn't be, at least, though I did notice I'd "lost" two of the image files for twitter & facebook icons. Again. But why those two and not the other two? Sigh.

naiara gonzalez
naiara gonzalez
16,778 Points

img { border-radius: 100%; }