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

Yu Ito
Yu Ito
12,711 Points

I'm stuck with the task "Then, set padding on the top and bottom to 15pixels.

I have no idea how to code.

3 Answers

Hi Yu,

The question is:

Select the links inside the nav element and set their font weight to 800. Then, set padding on the top and bottom to 15 pixels. Set the padding on the left and right to 10 pixels.

So, first we select the links inside the nav element with:

nav a {

}

Then we set the font-weight to 800 with:

font-weight: 800;

Then we set the padding. Since top and bottom are the same and left and right are the same, we only have to give it 2 inputs:

padding: 15px 10px;

First(15px) is for the top and bottom padding, second (10px) is for the left and right padding.

So, we end up with:

nav a {
  font-weight: 800;
  padding: 15px 10px;
}
Krzysztof Kucharzyk
seal-mask
.a{fill-rule:evenodd;}techdegree
Krzysztof Kucharzyk
Front End Web Development Techdegree Student 4,005 Points

All you have to do is to add padding to your element. use this site as a referal for how to apply paddings: CSS Paddings.

You can add padding to your css like this:

.your_element {
  padding: 10px 10px 10px 10px /* This will add padding to all sides starting from TOP -> RIGHT -> BOTTOM -> LEFT*/
}

.your_element_1 {
  padding: 10px 10px 10px /* This will add padding to: TOP, RIGHT & LEFT,  BOTTOM */
}

.your_element_2 {
  padding: 10px 10px  /* This will add padding to TOP & BOTTOM, RIGHT & LEFT */
}

.your_element_3 {
  padding: 10px  /* This will add all four paddings */
}

So in your case you have to add paddings only to top and bottom. You can do this in 2 different ways:

1st:

.your_element {
  padding: 15px 10px;
}

2nd:

.your_element {
  padding: 15px 10px 15px 10px;
}
Yu Ito
Yu Ito
12,711 Points

I appreciate your kind help!! Thank you so much!!