Learn Basic CSS by Building a Cafe Menu step 74

I am having trouble on step 74 of building a cafe menu. The problem is as follows along with my answer.
Problem:

Focusing on the menu items and prices, there is a fairly large gap between each line.

Target all the p elements nested in elements with the class named item and set their top and bottom margin to be 5px.

Answer:

.item p {
  margin-top: 5px;
  margin-bottom: 5px;
}
1 Like

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

2 Likes

bro u need to learn this; example

  1. margin: 1px 2px 3px 4px; means values of( top,right,bottom,left)
  2. margin: 2px 0; means top and bottom have value of 2px and right and left have value of 0
1 Like

Thank you for sharing this with me!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.