The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › CSS › Change background color of CSS tab label
I want to change background color of the selected tab label in this script:
When users click on one of the tab labels, the background color of the selected tab label should change to white to match the content’s background, and the label text should be white. I thought the last selector should do the job but it does not.
There is no parent, or previous sibling selector in CSS.
The general sibling selector (~) matches elements that are siblings of a given element, that come after it in the markup. It can’t go backwards/up the DOM.