1

How do I write the correct css selector for a data-qe-id?

<h2 data-qe-id="form-title" class="ctct-form-header">Sign up for updates!</h2>
<p data-qe-id="form-description" class="ctct-form-text">Get news from us in your inbox.</p>

This is specifically for modifying a Constant Contact email sign up box.

rollstuhlfahrer
  • 3,988
  • 9
  • 25
  • 38

3 Answers3

1

You could use

h2[data-qe-id="form-title"] {
    color: red;
}

Using square brackets, you can refer to attributes and their values of any given DOM element.

rollstuhlfahrer
  • 3,988
  • 9
  • 25
  • 38
1

You an attribute selector. Like this:

[data-qe-id] {
    color: red;
}

or attribute with specific value...

[data-qe-id="form-title"] {
    color: red;
}

or attribute with a value that starts with a certain string...

[data-qe-id^="form"] {
    color: red;
}
zgood
  • 12,181
  • 2
  • 25
  • 26
  • please see comment above...for some reason the custom CSS will not work with this in wordpress. – Kristin Guidi Apr 17 '18 at 15:32
  • @KristinGuidi That is valid CSS, I have no idea where or how you are implementing it. Your question was _How do I write the correct css selector for a data-qe-id?_ Not _How to implement custom CSS in Wordpress_. – zgood Apr 17 '18 at 15:38
  • It looks like I needed to use the selector#ctct_form_0 [data-qe-id="form-description"] {color: red; } – Kristin Guidi Apr 18 '18 at 16:57
0

Use the selector then the data-qe-id:

    #ctct_form_0 [data-qe-id="form-description"]{
           color: red;}