0

I'm experimenting with jquery-ui and looking at and cloning some examples. In one example (autocomplete's combobox) I see an anchor (a) element with class ui-widget which gets matched against .ui-widget .ui-widget { css: stuf} in the included css file.

I cloned more or less this example but my version of a.ui-widget matches .ui-widget { other-css: stuff} (as I would expect)

What would make the first example match the double entry in the css file and my cloning single entry.

I don't see any other relevant differences css entries are the same.

2
  • I don't really understand your question. What exactly is this element, which rules does it match and which rules does it not match? You'll want to list out all the relevant CSS rules and point to which ones match and which don't. Commented Feb 23, 2013 at 18:55
  • I think I forgot that the double .ui-widget means a parent and child element both have a .ui-widget class (which I understood from you erased answer. thanks!). For some reason the repetition prevented me from seeing parent child relation. Commented Feb 23, 2013 at 19:09

1 Answer 1

1

.ui-widget as a selector is more general (or less specific): it will match any element so long as the element has that class. A .ui-widget is still a .ui-widget, whether or not it is contained within some other .ui-widget element, so it will still match the .ui-widget selector.

If the rules with the .ui-widget selector are overriding the same rules declared with the selector .ui-widget .ui-widget for the same element, then something is wrong, since the latter is more specific and so should take precedence. But that doesn't stop both selectors from matching the same element since you're basically looking for the same class.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.