• Ask a Question
  • Create a Poll
150
    Ask a Question
    Cancel
    150
    More answer You can create 5 answer(s).
      Ask a Poll
      Cancel

      How to specify only child, and not the childs children with Css?

      I am trying to move an element so it fits with my card. I cannot seem to target the right element. I am currently trying to style the element on the description-container, with the :only-child() selector, but it also adds the children of the elements if there are any.

      Illustration:

      In the following picture, I want to select only the element out of place and colored it red to do so. However, the top element also gets colored red. This is what it looks like in the top element. The 2nd element (the one i am trying to target) is the same structure, but appears as an only child of descriptioncontaier. Where it goes wrong

      Where am I going wrong?

      Asked by Aldenmarisophia on July 15, 2020 in CSS.
      0 Answers