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

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

Marc Bell
Marc Bell
2,701 Points

Header/Portfolio pictures coding issue

Hey everyone!

First post on this forum and I could do with some help..

I'm having a coding issue whereby the first picture on my 'portfolio page' is coming up along the right hand side next to the header, meaning the desktop view looks odd because the width of the header is reduced to accommodate the first image on the right hand side.

The view on a reduced screen size i.e smartphone looks ok in that the images stay in a two column list. I can't for the life of me work out where I've gone wrong! Any suggestions? Here's some relevant code that may help identify the problem (from my responsive.css file) - let me know if you need any more info;

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

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

primary {

width: 50%; float: left; }

secondary {

width: 40%; float: right; }

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

gallery li {

width: 28.3333%; }

gallery li:nth-child(4n) {

clear: left; }

}

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

/************************ 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%; }

}

Many thanks! Marc

3 Answers

rydavim
rydavim
18,814 Points

It's difficult to say for sure without seeing all of your files and code, but I have a guess. It's possible the float styles on your header are interfering with your profile picture's positioning. Try adding a clear to your profile photo styles.

.profile-photo {
  clear: both;  // Add this line here to your .profile-photo styles! <---
}

If that doesn't do it for you, please post a workspace snapshot and I'll take a closer look. Happy coding!

Marc Bell
Marc Bell
2,701 Points

Hey,

It seems to have gone even crazier now! I've lost the header on my index.html and the first picture of the gallery is up alongside the header on the right. I'm debating starting again, although I know it's probably just a few lines of code that's causing all of this!

It doesn't seem that any of the changes I make to the responsive.css file are being reflected in the pages, specifically the index page.

Here's my code snapshot..hope it makes sense! https://w.trhou.se/jyjperuzc6

Thanks, Mar

rydavim
rydavim
18,814 Points

Alright, looking at your code you've got a couple of issues.

In your HTML, you've given the header element the id #logo - I think this id is meant for the anchor element wrapping your name.

<a href="index.html" id="logo"> <!-- The logo id should be here I think. -->
  <h1>Marc Bell</h1>
  <h2>Designer</h2>
</a>

Then in your responsive.css file your styles are a little bit mixed up, since the logo id is different now.

/* These styles are marked header in your responsive.css file. */
nav { 
  background: none; 
  float: right;
  font-size: 1.125em;
  margin-right: 5%;
  text-align: right;
  width: 45%;
}

I think those two minor changes pretty much fixed it for me. You'll need to fix the HTML in your contact and about files as well. Other than that, it looks good to me. Nice job, and happy coding! :)

Marc Bell
Marc Bell
2,701 Points

That's great, thanks so much..my header is back!