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

Centering contact links for background images

It appears that the links are aligned with the top of the image and the padding for each list item in between the icon and link is different.

http://i.imgur.com/EIHDHdY.png

HTML

<section>
        <h3>Contact</h3>
        <ul id="contact">
          <li class="phone"><a href="tel:503-503-5030">503-503-5030</a></li>
          <li class="mail"><a href="mailto:nobody@no.com">nobody@no.com</a></li>
        </ul>
</section>

CSS

#contact a {
    display: block;
    min-height: 30px;
    background-repeat: no-repeat;
    background-size: 30px 30px;
    margin: 0 0 0 15px;
    padding: 0 30px 0 30px;
}

.phone a {
  background-image: url("../img/phone.jpg");
}

.mail a {
  background-image:url("../img/mail.jpg");
}

2 Answers

I believe centering elements vertically is possible with flexbox.
Also I believe the padding of the links is the same. If you add a border to the images you will see that they are of the same size.

Ben

Does a "div" contain the section? Does the CSS contain styling for the section? For the <ul> item try styling "margin: 0 auto; " The containing element i.e. section must a width of max-width: 100%;

Bob