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

Sam Ford
Sam Ford
2,633 Points

Hi, i can not get my image to stack above my text when making the window smaller to a mobile device size!?

Here is my code:

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

  /* **********************
  Two column layout
  ********************** */

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

  #secondary { 
    width: 40%;
    float: left;
  }


  /* **********************
    3 * 5 = 15 

    100% - 15% = 85%

    85 / 3 = 28.333333333 
    ********************** */

  /* **********************
  Portfolio Page
  ********************** */

  #gallery li {
    width: 28.3333%;
  }

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


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

  .profilePhoto {
    float: left;
    margin: 0 5% 80px 0;   
  }

}

HTML

<!DOCTYPE html>

<html>

<head>
    <meta charset="UTF-8" /> 


    <title>Samford | Portfolio</title>

    <link rel="Stylesheet" href="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="Stylesheet.css" />
    <link rel="Stylesheet" href="Responsive.css" /> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

</head>

<body>

<header>

<a href="Home.html" id="logo">
    <h1>Samford</h1>    

        <h2>Portfolio</h2>

</a>

<nav> 
    <ul>
        <li><a href="Home.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/ThierryHenry.jpg" alt="Photo of Henry" class="profilePhoto" />
        <h3>About</h3>
        <p>Hi, I'm Theirry Henry, I am a Arsenal Legend, this is my portfolio test page! I am now a TV pundit on Sky Sports! </p>
        <p>If you would like to follow me on twitter, my user name is <a href="http://www.twitter.com/ThierryHenry">@ThierryHenry</a></p>

    </section> 

    <footer>

        <a href="http:www.facebook.com/samfordbb"><img src="Img/facebook-wrap.png" alt="Facebook Logo" class="social-icon" /></a>   
        <a href="http:www.twitter.com/_samford"><img src="Img/twitter-wrap.png" alt="Twitter Logo" class="social-icon" /></a>
        <p>&copy; 2014 Samford Development.</p> 

    </footer> 

</div> 

</body>

</html>

We kind of need to see your HTML to make sure your CSS is correct, and to help test.

2 Answers

Sean T. Unwin
Sean T. Unwin
28,690 Points

.profilePhoto should be .profile-photo

Sam Ford
Sam Ford
2,633 Points

I didn't use the example class in the video i have set my own class of profilePhoto in my HTML, thanks for the feedback anyway

Sean T. Unwin
Sean T. Unwin
28,690 Points

Ah, I see. I that case we may need to see your HTML.

It is generally considered best-practice to use hyphen separated words for classes and camelcase for JavaScript, and possibly HTML ID attributes. You may, of course use what you want though. :)

geoffrey
geoffrey
28,736 Points

Hey there, as some people have this issue, I decided to have a look at it, I downloaded the project files and opened the project in my browser. It seems I don't have as well the image well displayed under firefox but correctly under chrome. However, I fixed it by applying others styles. You can check my answer with the solution here

I as well asked Nick to enlight us if possible.