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

Can someone review my code?

Here is an image of what the website looks like completed: https://docs.google.com/file/d/0B3zvdFSXn-36UXpIOTJxOTZsZGs/edit?usp=drivesdk

Here is the index.html file:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <link href='http://fonts.googleapis.com/css?family=Great+Vibes' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="main.css">
  </head>
  <body>
    <header>
      <h3>camara designs</h3>
      <nav>
        <ul>
          <li class="portfolio"><a href="index.html">portfolio</a></li>
          <li class="about"><a href="about.html">about</a></li>
          <li class="contact"><a href="contact.html">contact</a></li>
        </ul>
      </nav>
    </header>
    <section>
      <div id="imageDiv">
      <img src="img/placeholder.jpg">
      <img src="img/placeholder.jpg">
      <img src="img/placeholder.jpg">
      <img src="img/placeholder.jpg">
      <img src="img/placeholder.jpg">
      <img src="img/placeholder.jpg">
      </div>
    </section>
    <footer><p>Copyright &copy; 2015 Lansana Camara.</p></footer>
  </body>
</html>

Here is the main.css file:

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

* {
  margin: 0;
  padding: 0;
  font-family: sans-serif;
  box-sizing: border-box;
}

body {
  background-color: #4D505B;
  color: #F4F4F2;
  max-width: 100%;
  margin: auto;
  text-align: center;
  font-size: 1em;
}

li {
  list-style: none;
}

a {
  text-decoration: none;
}

/***********************
NAVIGATION
************************/

li {
  display: inline-block;
  margin: 40px 20px 35px;
  padding: 20px 20px ;
  font-size: 1.075rem;
  font-weight: bolder;
}

li.portfolio {
  background-color: #CF4858;
}

li.about {
  background-color: #16A79D;
}

li.contact {
  background-color: #80628B;
}

/***********************
HEADER
************************/

h3 {
  font-family: 'Great Vibes', cursive;
  float: left;
  padding: 30px;
  margin: 10px 0;
  font-size: 3rem;
  border-right: 1px solid rgba(207, 72, 88, .3);
}


/***********************
SECTION
************************/

section {
  background-color: #393C44;
  float: left;
}

img {
  display: inline-block;
  max-width: 30%; 
  padding: 10px 10px 20px;
}

#imageDiv {
  padding-top: 20px;
  border-top: 1px solid rgba(207, 72, 88, .5);
  border-bottom: 1px solid rgba(207, 72, 88, .5);
}

/***********************
FOOTER
************************/

footer {
  display: inline-block;
}

footer p {
  margin: 10px;
}

/***********************
LINKS
************************/

a:link {
  color: white;
}

a:visited {
  color: white;
}

a:active {
  color: white;
}

/***********************
COLORS
************************/

h3 {
  color: #F26964;
}

li {
  color: #517398;
}

footer p {
  color: #C3DAE3;
}

/***********************
CLEAR FLOATS
************************/

li:after {
  content: "";
  display: table;
  clear: both;
}

Could I have coded this any more efficiently? What I mean by that is, do I have any redundant code or are there better ways to do anything I did? Thanks!

1 Answer

Aaron HARPT
Aaron HARPT
19,845 Points

You could combine the following code so you were not repeating the color white on more than one selector: Something like: a:link, a:visited, a:active { color: white; } instead of having three separate selectors. hope that helps.