Among the forms of CSS selectors, one particular that is often disregarded may be the CSS Adjacent Selector.
Adjacent sibling selectors hold the subsequent syntax: E1 + E2, in which E2 is the topic with the selector. The selector matches if E1 and E2 reveal the same mother or father within the document tree and E1 instantly precedes E2.
The CSS code
h4 + p font-weight: bold; color: #000;
The text below is really a simple illustration of your above code:
This really is standard heading 4 text
This is the <p> after the heading. It should be bold and black.
What’s even better is that this seems to work perfectly in IE 7 (UPDATE: it seems that this does not work in IE6, so it will likely be a bit before this really is usable on any large scale. However, it is still good to understand these obscure CSS selectors because you may come across them as a professional,
Windows 7 Home Premium Key, especially if IE8 successfully puts IE6 out of the top 5 browsers), Firefox, Opera, and Safari. Now I know what you’re thinking. Exactly where in the world am I going to use this?
Perhaps we could use something like this to do something to all rows in a table except the first row? What if we knew the next element after an <img> tag was going to be considered a custom caption that we wanted to place properly underneath our image? The only problem I see is that this couples the HTML and CSS more than we might like sometimes. However,
Office Standard 2010 Sale HP PAVILION DV1000 SERIES battery, Cheap HP PAVILION D, there are many places that probably would benefit from something this simple. Simplicity rules. Now that you know how to use it I have every confidence you can come up with a brilliant use for it.
What ideas do you have to use this CSS gem? What other selectors have you found useful but don’t typically see?