• Hi,

    My page is http://www.viisam.fi. I have different widgets there, and the problem is that, if i want to add css to only certain div…how to do that?
    For example if i want to add black background to to contact form in the bottom?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi Take245,

    If the element you want to target has an ID, you can use that because the ID is unique. For example, to target just that form at the bottom (not the div but the form), write this CSS rule:

    #wpcf7-f173-o1 form {
        background-color: black;
    }

    There are other, more complex ways of targeting elements in CSS, but for them to work the elements need to always occupy the same place in the page. For instance, if you move a widget from the top to the bottom, you would need to re-target the element with a new CSS rule. This is not very practical in a dynamic Content Management System environment like WordPress. Using IDs, sparingly and only in specific situations like this one, would be the best solution.

    I hope this helps 🙂
    – Maria Antonietta

    Thread Starter take245

    (@take245)

    Yes! It worked thank you very much! 🙂

    You’re very welcome 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘How to add css to only certain div?’ is closed to new replies.