Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS How to Make a Website Styling Web Pages and Navigation Style the Image Captions

How do you create two columns for images in a gallery?

I can't figure out what is wrong with my code so that my images will appear in two columns and bullet points will be excluded. Below is the code I have written.

/************************** GENERAL ***************************/

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

wrapper {

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

a { text-decoration: none; }

img { max-width: 100%; }

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

gallery {

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

gallery li {

float: left; width: 45%; margin: 2.5%; background-color: #f5f5f5; color: #bdc3c7; }

4 Answers

Maja B.
Maja B.
12,984 Points

Hi, send us also the HTML (not just CSS) code. In this way will have the whole picture and we will be able to help you, Cheers, Maja

Here is the HTML. Thank you for your help.

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Mary Sutherland | Entropreneur</title> <link rel="stylesheet" href="css/normalize.css"> <link href='http://fonts.googleapis.com/css?family=Vollkorn:400italic,700italic,400,700|Cuprum:400,400italic,700,700italic' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="css/main.css"> </head> <body> <header> <a href="index.html" id="logo"> <h1>Mary Sutherland</h1> <h2>Entropreneur</h2> </a> <nav> <ul> <li><a href="index.html"class="selected">Portfolio</a></li> <li><a href="about.html">About</a></li> <li><a href="contact.html">Contact</a></li> </ul> </nav> </header> <div id="wrapper"> <section> <ul id= "gallary"> <li> <a href="img/numbers-01.jpg"> <img src="img/numbers-01.jpg" alt=""> <p>Experimentation with color and texture.</p> </a> </li> <li> <a href="img/numbers-02.jpg"> <img src="img/numbers-02.jpg" alt=""> <p>Playing with blending modes in Photoshop.</p> </a> </li> <li> <a href="img/numbers-06.jpg"> <img src="img/numbers-06.jpg" alt=""> <p>Trying to create 80's style of glow.</p> </a> </li> <li> <a href="img/numbers-09.jpg"> <img src="img/numbers-09.jpg" alt=""> <p>Drips created using photoshop brushes.</p> </a> </li> <li> <a href="img/numbers-12.jpg"> <img src="img/numbers-12.jpg"> <p>Creating shapes using repetition.</p> </a> </li>
</ul> </section> <footer> <a href="http://facebook.com/mary.sutherland.501"><img src="img/facebook-wrap.png" alt="Facebook Logo"></a> <p>© 2014 Mary Sutherland.</p> </footer> </div> </body> </html>

Maja B.
Maja B.
12,984 Points

Hi, Mary,

I think the problem is in the selector gallery li.

Write ul#gallary li instead of gallery li. Why?

  1. gallary is and id so it needs the sign # infront of it
  2. gallray is an universal list so it needs ul infront of it
  3. it is gallary not gallery (note the letter e instead of a)

For the footer you can write footer {clear:both;} to push it to the bottom.

Hope it helps, Maja

Thank you Maja! Your suggestion worked and now my page looks as it is suppose to. ~Mary

Maja B.
Maja B.
12,984 Points

Nice to hear that, happy coding, Maja.