Question: I want to make something like `nth-last-child(1 + odd)`, where the last child is affected but **ONLY if the element is odd**.

`nth-last-child(1 + odd)` doesnt work though, so what should I do?

---

**Bonus:** A more flexible answer allowing me to grab the last child, only if it is odd and the odd child before it.

```
<ul>
  <li>not effected</li>
  <li>not effected</li>
  <li>not effected</li>
  <li>not effected</li>
  <li>affected</li>
  <li>not effected</li>
  <li>affected</li>
</ul>

```

but if the last child is EVEN, nothing happens, so:

```
<ul>
  <li>not effected</li>
  <li>not effected</li>
  <li>not effected</li>
  <li>not effected</li>
  <li>not effected</li>
  <li>not effected</li>
</ul>

```

Answer: 
I'd suggest a slightly different approach using two pseudo-classes:

```
:nth-child(odd):last-child

```

This first selects all odd child elements, and refines the selection to only the last-child of the parent element.

```css
div {
  margin: 0 0 0.5em 0;
}
span {
  display: inline-block;
  counter-increment: spanIndex;
  width: 2em;
  height: 2em;
  border: 2px solid #000;
  border-radius: 25%;
  margin: 0 0.5em 0 0;
}

span::before {
  content: counter(spanIndex, decimal-leading-zero);
}

span:nth-child(odd):last-child {
  background-color: #f90;
}
```

```html
<div><span></span><span></span><span></span><span></span><span></span></div>
<div><span></span><span></span><span></span><span></span><span></span><span></span></div>
```
You can combine both selectors like this:

```
:last-child:nth-child(odd)

```

**DEMO**
<http://codepen.io/dschu/pen/XmbKmq>

**SCSS**

```
ul 
{
  li
  {
    &:last-child:nth-child(odd)
    {
      background-color: red;
    }
  }
}

```