View Full Version : Opposite Selector +

07-21-2011, 03:58 AM

I'm using a little padding to space the tab next to the selected tab (white), since I'm using a width on the <a> to give it a more "equal look". So I'm using + to select the next tab in order to push it over to the right (by 5 px). However, if a tab other than the first is selected, the tab to the left also needs to be pushed. My question is what is the selector to choose the tag before? I tried :before but it didn't seem to have an effect. My question really isn't about an alternate solution, I'm more interested in the selector to use.

- thanks

#mastHead .bin,
#mastHead .bin ul.nav,
#mastHead .bin ul.nav li,
#mastHead .bin ul.nav li a {
height: 28px;

#mastHead .bin ul.nav {
font-size: 13px;

#mastHead .bin ul.nav li a {
color: #EEE;
font-weight: bold;
line-height: 28px;
width: 80px;
text-align: center;

#mastHead .bin ul.nav li.selected + li a {
padding-left: 5px;
padding-right: 1px;

07-21-2011, 05:27 AM

07-21-2011, 05:31 AM
unfortunately there is not yet an opposite to +

:before is not a selector, it is a pseudo-element.

It is used when you want to add content before the original content of the specified element.

div:before {content: "Mega"}
<div>bomb</div>will act as if you have written