Select a child of a parent element

Hello everybody,

I have a little probleme when
when I select a particular element, all the article mouth.

I would like to select child element of a parent ?
The class name “element-price” .

Is the syntax bad? I do not put spaces between the elements?
Thank you for your help.


<article class="article-second-page">

                    <div class="text-item">

                      <h4>Science</h4>

                      <p class="Explain">Why you do select this ?</p>

                      <div  class="element-price">25</div>

                      <div class="check">

      </div>
</div>

                  </article>

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 (’).

Thank you for this information which will be very useful to me. I start then sorry for the errors. I couldn’t find the option to ask for help to turn my post into a challenge.

that was the wrong message, it’s if you need help while doing the fcc curriculum


for your request, is that all your code? what do you want to select?
how are the two snippets connected to each other?

So you are wanting to just select the element

<div class="element-price">25</div>

?

If you want just one element, set an id on that element. Make sure the id is unique, not used for anything else.

Then select that id in the CSS referencing the id

See this:

HTML id Attribute

id is similar to class, but class is not unique, more that one element can belong to a class.

For class, you use a dot “.” , for id you use a hash sign “#”.

Than you @a_aramini for your help

I have already tried by selecting its class, it does not work, I will try with the id.

Yes, selecting by class will select every element with that same class name, this is not what you want. id instead :slightly_smiling_face:

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