mickey06
mickey06

Reputation: 171

What kind of css selector is this ? What does it mean?

While trying to understand bootstrap I came across this :

.control-group.error input, [...] { [...] }

It looks like a descendant selector but .control-group.error is a class.

I looked through this and I couldn't find anything : http://css.maxdesign.com.au/selectutorial/

Can anyone give me some pointers ?

Upvotes: 2

Views: 195

Answers (1)

James Allardice
James Allardice

Reputation: 165971

Assuming I've understood your question correctly, .control-group.error will match any elements that have both control-group and error class names.

As you said, the input will match any input element that is a descendant of any element with the class names control-group and error.

For example, it would match:

<form class="control-group error">
    <input> <!-- It matches this (both class names on form) -->
</form>

And it would not match:

<form class="control-group">
    <input> <!-- It won't match this (only one of the class names on form) -->
</form>

Upvotes: 4

Related Questions