CSS: Which class to use?

Hello,

I am trying to understand the difference between the below two classes and when to use one or the other:

.class {css declarations;}
<p class="flavor">French Vanilla</p>

what does each do?

I think you’ll need to give us the step number you are having trouble with. I’m assuming this is for the Cafe Menu course. Also, I’m not seeing “two classes below”. Were you trying to post CSS/HTML in here? If so, you need to use the triple back tick method.

To display your code in here you need to wrap it in triple back ticks. On a line by itself type three back ticks. Then on the first line below the three back ticks paste in your code. Then below your code on a new line type three more back ticks. The back tick on my keyboard is in the upper left just above the Tab key and below the Esc key.

Hey @Aschettini22 , 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

It is a general question this is the reason I did not add the steps or my work.

OK, now that I can see your code I think I understand your question.

This is CSS syntax. The .class here is a selector which says “target all elements with the class of class and apply the styling specified”. You use this syntax in your CSS file or in between the style tags in your HTML.

This is the way to set a class name on an element. It doesn’t do anything special other than allow you target the element by class name in your CSS. You use this syntax on your HTML elements.

1 Like

When I read question about class I get confused of which of those two they are asking. Thank you