I have a list of items related to each other
<dl>
<dd data-grupo="1">1. Tomatoes</dd>
<dd data-grupo="1">2. Cucumbers</dd>
<dd data-grupo="1">3. Mushrooms</dd>
<dd data-grupo="2">4. Apples</dd>
<dd data-grupo="2">5. Mangos</dd>
<dd data-grupo="2">6. Pears</dd>
<dd data-grupo="2">7. Oranges</dd>
</dl>
How can I select the first and last sibling in the group data-grupo="1"
and data-grupo="2"
to make them red and blue? Using only css
I've tried
dl dd[data-grupo="1"]:first-child,
dl dd[data-grupo="1"]:last-child{
background: red;
}
dl dd[data-grupo="2"]:nth-child(1),
dl dd[data-grupo="2"]:nth-child(-1){
background: blue;
}