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 Adding Pages to a Website Add Iconography

Tom Price
Tom Price
5,670 Points

Problem with icons - help!

My icons have come out looking like this: http://imgur.com/cHVcA8G

The code looks like it should be fine, but I'm probably missing something obvious.

Could someone maybe take a look at my code and see if I've made a mistake along the way? Thanks.

<!DOCTYPE html>
<html>
  <head>
    <meta lang="en" charset="utf-8">
    <title>Tom Price | Aspiring Web Developer</title>
    <link rel="stylesheet" href="css/normalize.css">
    <link href='https://fonts.googleapis.com/css?family=Roboto+Condensed' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="css/styles.css">
  </head>
  <body>
    <header>
      <a href="index.html" id="logo">
        <h1 class="name">Tom Price</h1>
        <h2 class="job-title">Aspiring Web Developer</h2>
      </a>
      <nav>
        <ul>
          <li><a href="index.html">Portfolio</a></li>
          <li><a href="about.html">About</a></li>
          <li><a href="contact.html" class="selected">Contact</a></li>
        </ul>
      </nav>
    </header>
    <div id="wrapper">
      <section>
        <h3>General Information</h3>
        <p>Feel free to get in touch any time you want, using the provided contact details.</p>
      </section>
      <section>
        <h3>Contact Info</h3>
        <ul class="contact-info">
          <li class="phone"><a href="phone:123-1122">123-1122</a></li>
          <li class="mail"><a href="mailto:john.doe@email.com">john.doe@email.com</a></li>
        </ul>
      </section>
      <footer>
        <a href="http://www.facebook.com">
          <img src="img/facebook.png" alt="Facebook logo" class="social-media">
        </a>
        <a href="http://www.twitter.com">
          <img src="img/twitter.png" alt="Twitter logo" class="social-media">
        </a>
        <a href="mailto:tom_p@hotmail.co.uk">
          <img src="img/mail.png" alt="Email logo" class="social-media">
        </a>
        <p>&copy; 2016 Tom Price</p>
      </footer>
    </div>
  </body>
</html>
/*********************************
PAGE: CONTACT
*********************************/

.contact-info {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.9em;
}

.contact-info {
  display: block;
  min-height: 20px;
  background-repeat: no-repeat;
  background-size: 20px 20px;
  padding: 0 0 0 30px;
  margin: 0 0 10px;
}

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

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

1 Answer

Hi,

Its a common problem and is covered by Nick in this video around 05:40.

You need to apply a min-height etc. to the .contact-info a element (you have specified .contact-info twice)

Try this:

/*********************************
PAGE: CONTACT
*********************************/

.contact-info {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.9em;
}

.contact-info a {
  display: block;
  min-height: 20px;
  background-repeat: no-repeat;
  background-size: 20px 20px;
  padding: 0 0 0 30px;
  margin: 0 0 10px;
}

.contact-info li.phone a {
  background-image: url('../img/phone.png');
}

.contact-info li.mail a {
  background-image: url('../img/mail.png');   
}

Hope this helps :)

Tom Price
Tom Price
5,670 Points

Yeah, it worked. Thanks a lot!