Above I setup a JS Fiddle to demonstrate my current code.
The gray boxes represent .classlinks, the black boxes #link_wrap a.
Each item has a .classlinks wrapped around it. As you will notice, each item except one (2) is unlinked.
How would I apply the gray background to the unlinked element only wikthout using nth-child? This is being used in WordPress for pagination, so the links are generated by WordPress, so the unlinked element is not static.
Fixed. Because this is for WP_LINK_PAGES and adding a different class to the middle span would require a custom function. As i said, the links are generated in WP.
http://jsfiddle.net/6PvLj/1/
Above I setup a JS Fiddle to demonstrate my current code.
The gray boxes represent .classlinks, the black boxes #link_wrap a.
Each item has a .classlinks wrapped around it. As you will notice, each item except one (2) is unlinked.
How would I apply the gray background to the unlinked element only wikthout using nth-child? This is being used in WordPress for pagination, so the links are generated by WordPress, so the unlinked element is not static.
Use the span.
You'll have to make sure the colours match though, by explicitly setting one. In the fiddle below I used blue.
http://jsfiddle.net/veaJW/
That didn't do it. I was looking to apply the grey background to the unlinked element (2) only. This simply made everything one color.
Why not just give your middle span a different class and then target it with the CSS you want?
Also your HTML is dodgy, you haven't closed some of the spans.
Fixed. Because this is for WP_LINK_PAGES and adding a different class to the middle span would require a custom function. As i said, the links are generated in WP.
I came up with this
http://jsfiddle.net/YBtAY/