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 Styling Web Pages and Navigation Style the Portfolio

WTF? CSS for # gallery isn't working for the pictures. It works for the background frame, and captions.

Ok, so I'm way ahead of this video, but recently went back to index.html and after fiddling with about.html. Now, when I look at my profile page/index.html, the pictures are not listening to the CSS. Everything else works such as the captions, and the background color/frame, padding, margins, list-style... but the pics aren't listening!

----------here's my gallery CSS-----------

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

gallery{

margin:0; padding: 0; list-style: none; }

gallery li {

float:left; width: 45%; margin: 2.2%; background-color:#f1f1f1; color: #bdc3c7; }

gallery li a p{

margin:0; padding: 5%; font-size: 1em; color:#bdc3c7;

}

-------------here's my HTML:-------------

<div id = "wrapper">

    <section>
      <p> Move Date: Sept. 1, 2016</p>
      <ul id= "gallery">
        <li>
          <a href="img/inTheVan.jpg">
            <img src="img/inTheVan.jpg" alt="">
            <p>We are blurry...  </p>
          </a>
        </li>
        <li>
          <a href="img/kellyBashfulAspens.jpg">
            <img src="img/kellyBashfulAspens.jpg" alt="">
            <p>Aspens make her shy...</p>
          </a>
        </li>
        <li>
          <a href="img/kellyOnARock.jpg">
            <img src="img/kellyOnARock.jpg" alt="">
            <p>rocks on rocks...</p>
          </a>
        </li>
        <li>
          <a href="img/theVan.jpg">
            <img src="img/theVan.jpg" alt="">
            <p>NO PAIN NO GAIN!</p>
          </a>
        </li>
        <li>
          <a href="img/tpChillin.jpg">
            <img src="img/tpChillin.jpg" alt="">
            <p>If you're lost, build a home.</p>
          </a>
        </li>
      </ul>
    </section>

Could this be a workspace glitch? recently this week... If I click the preview button, it wouldn't take me to a new window, it would load on my workspace window, and I would have to close and reopen workspace to edit. Sometimes the "back" keyboard short cut would work, sometimes it wouldn't... frustrated.

So again, the picture's captions, and the background frame/color adjust with the screen, but the actual pictures aren't listening. They were at one point!!! and just decided on their own to be uncooperative.... (so it seems... :)~...)

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,858 Points

Hey Austin,

It's not a glitch, sorry.

You have a spacing issue in the naming of the class in the HTML. You have a space between the equal sign and the "gallery" and this is what is causing the CSS not to style properly. Normally whitespace is not an issue in HTML unless you are assigning values to attributes.

Just delete that space and you're good to go. :)

:dizzy:

That did not fix the problem. If I can screen shot anything or copy paste, please let me know. I'm pretty stumped at the moment.

That did not fix the problem. If I can screen shot anything or copy paste, please let me know. I'm pretty stumped at the moment.