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 Styling Web Pages and Navigation Create a Horizontal List of Links

How to set the left padding to 0? This is for the selector nav ul

it asks to remove the padding on the unordered list and I get an error saying did you set the left padding to 0?

css/main.css
a {
  text-decoration: none;
}

#wrapper {
  max-width: 940px;
  margin: 0 auto;
}

#logo {
  text-align: center;
  margin: 0;
}

h1, h2 {
  color: #fff;
}

nav ul {
  list-style: none;
  margin: 0 10px;
  padding 0;
}

nav a {
  color: #fff;
}

nav a:hover {
  color: #32673f;
}

h1 {
  font-family: Changa One, sans-serif;
  font-size: 1.75em;
  font-weight: normal;
}

img {
  max-width: 100%;
}

#gallery {
  margin: 0;
  padding: 0;
  list-style: none;
}

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

3 Answers

Bryce Santos
Bryce Santos
11,157 Points
nav ul {
  list-style: none;
  margin: 0 10px;
  padding-left: 0;
}

If it's asking you to remove the padding then simply erase the padding property and its value.

For applying padding specifically to the left use the 'padding-left' property.

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

Hey Grady,

Just removing the padding property is not a good idea and will often not work for a few reasons.

  1. All browsers have default CSS settings that are applied if there are none set by a CSS file. Hence, if you just remove the padding rule, the browser could add it's own default setting.

  2. If you are using any sort of CSS reset or Normalize, and you remove the rule, you risk it defaulting to the one in the reset.

  3. If you have set the rule somewhere else in your style sheet (or another style sheet), it will just default back to that one.

So, if you truly want the left margin to be Zero, then you do have to write a rule and set its value to 0.

:dizzy:

Hey Jason

Thanks you for your response.

Those are all very valid points, I'll keep them in mind for the future, especially when using descendant selectors!

Thanks again.

I figured out my problem. I just forgot a colon after padding. padding: 0 Thanks anyway guys!

Bryce Santos
Bryce Santos
11,157 Points

No problem! Glad you found the solution.