Reputation: 13930
See an example at this jsfiddle,
#rightDiv a#id1match { left:60px;top:10px }
where the changes to #id1match
or a#id1match
destroys the layout.
My "invalid logic" here was: #id selector points to a unique ID in the document, so, the "id inside other thing" must be the same than "id"... And in this case the HTML always have both IDs, not change... The inside selector should not have any influence in the ID when both exists.
Upvotes: 0
Views: 774
Reputation: 69983
You should read up on CSS Specificity.
#id1match
does correctly match your element. However that element also has the class .region
which has a more specific selector of #rightDiv .region
So basically your styling is being overriden because when you remove #rightDiv
the rule becomes less important. Look at your element in any developer tools and you can see what is happening.
Upvotes: 1