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.

Taylor Bryce
835 PointsHow do i centre gallery list items ?
Hi, I have finished the How To Make A Website and have am now looking to edit the CSS.
Since the course ended, I have updated the html to only have four images while keeping the existing css intact.
I have noticed though that gallery list items are off entered to the left hand side. I take it this is because of the li {float:left;} ?
How do i make these 4 list items sit centre in the screen while keeping it intact to have two items per row?
Below is my css + html:
HTML:
<ul id=gallery>
<li>
<a href="img/tour.jpg">
<img src="img/tour.jpg" alt="">
<p>Up Coming Show</p>
</a>
</li>
<li>
<a href="img/perform.jpg">
<img src="img/perform.jpg" alt="">
<p>Music</p>
</a>
</li>
<li>
<a href="img/vidshoot.jpg">
<img src="img/vidshoot.jpg" alt="">
<p>Videos</p>
</a>
</li>
<li>
<a href="img/merch.jpg">
<img src="img/merch.jpg" alt="">
<p>Merch</p>
</a>
</li>
</ul>
</section>```
CSS:
#gallery {
margin: 0;
padding: 0;
list-style: none;
}
#gallery li {
float: left;
width: 45%;
margin: 1%;
padding: 1%;
background-color: #d9d9d9;
color: #bdc3c7;
}
#gallery li a p {
margin: 0;
padding: 3%;
font-size: 0.75em;
color: #000;
}
Thanks in advance!