I'm a little clueless as to the correct use of first-child
.
I have a (dynamically generated) element, which eventually will include:
<h1>
<a>Foo</a>
<a.trigger>Trigger A</a>
<a.trigger>Trigger B</a>
<span.bar>Bar</span>
</h1>
I need to style both the trigger
links. This is what I'm doing:
.ui-collapsible-tabs.ui-dynamic-tabs .ui-collapsible-heading a.trigger {
background: none repeat scroll 0 0 transparent;
border: 0 none;
border-radius: 0;
box-shadow: none;
position: absolute;
right: 2em;
height: 100%;
top: 0;
width: 2em;
}
.ui-collapsible-tabs.ui-dynamic-tabs .ui-collapsible-heading a.trigger:first-child {
right: 0;
background-color: red !important;
border-right: 1px solid red;
}
I have tried both a.trigger:first-child
and a.trigger:nth-of-type(1)
but I'm not able to override the CSS set by the first rule. Both selectors have same specificity, too, so that cannot be the reason.
Question:
I guess I'm missing something obvious... maybe someone can help me out. Thanks!