Skip to content Skip to sidebar Skip to footer

Using Universal Selector (*) In Conjunction With The Adjacent Selector (+)

When is the right time to use the universal selector in combination with the adjacent selector in CSS? For instance: * + fieldset {...}

Solution 1:

This will be good when fieldset is not the :first-child.

The below snippet demonstrates the best use-case:

* + fieldset {
  background: red;
}
<div><fieldset>
    ...
  </fieldset></div><div><p>...</p><fieldset>
    ...
  </fieldset></div>

Post a Comment for "Using Universal Selector (*) In Conjunction With The Adjacent Selector (+)"