Using multiple element in CSS designations

I probably am not using the right lanuage in the title but I want to know how to correctly apply a pseudo class to multiple elements.

I tried doing this but it doesn’t work:

input, select, textarea:invalid {
border: 2px solid red;
}

Thanks.

share your code snippet along with step or exercise url for more clarity, happy coding :slight_smile:

Hi buddy, See here by using this option you can do add your code here.

so do you want to use the pseudoclass on all of those elements? then you need to add it to all those elements, right now the only one with a pseudoclass is textarea:invalid

So that’s the question. From a best practice point of view, would I do it like this?

input:invalid, select:invalid, textarea:invalid {
border: 2px solid red;
}

Or just create 3 separate CSS entries?

if you want to give the same style you can do that, if you want to give different styles you can use 3 separate CSS entries