Set css style for a lable with different ID's

Viewed 33

Based on that How to select label for="XYZ" in CSS? question I have a more detailed question.

We have a form where we can enter the recipient email address. This is how the HTML looks like:

<label for="recipient_email[0]">Text</label>

We know that we can select that specific label field with that CSS:

label[for="recipient_email[0]"] {
    color: #fff !important;
}

Problem: Then a ID is added to that label field. This ID is always changing and therefor the CSS above does not work anymore. Is there a hack we can use for that problem?

<label for="recipient_email[fdb450312833afa7e5c9faf377e4f872]">Text</label>

Cheers

1 Answers

Unfortunately, this selector does not exist, you can use an id for each label, for example:

<label id="label1" for="recipient_email[0]">Text</label>
<label id="label2" for="recipient_email[1]">Text</label>
<label id="label3" for="recipient_email[2]">Text</label>
Related