5 ms·
Can't say I understood what it does from that post, so here's another description: http://reference.sitepoint.com/css/generalsiblingselector http://reference.s
by sgdesign 14y ago
Can't say I understood what it does from that post, so here's another description:
http://reference.sitepoint.com/css/generalsiblingselector http://reference.sitepoint.com/css/generalsiblingselector
- freditup 14y agoThanks, I was confused too :D
- bstar77 14y agoIt looks like it's just taking the place of having to attach an event to the radio button, doing a lookup on the sibling #find_me element and manipulating it's style via JS. These types of things are great, the more we move away from JS DOM hacks the better.
- latch 14y agoI had no idea what ~ did after reading that post. Should have simply stated that: "The tilde (~) selector lets you target a sibling element. That is, an element that shares the same parent" Could then explain how it's different than the + selector. "This differs from the + selector which will only find an adjacent sibling (immediately following)." I'd consider comparing it to the child and descendant selector, if I could word it properly. This is what I have which I'm not happy with: "In some ways, the differences between + and ~ are like the differences between the child selector (>) and the descendant selector (a space), in that #header > a will only a elements directly under #header, while header a will target all a elements under #header, regardless of depth.
- neduma 14y agoThis is far better then original article. +1
- alanh 14y ago“…sibling element. That is, an element that shares the same parent.” Unfortunately, that is not true. It only matches following siblings. See my JSFiddle demo: http://jsfiddle.net/alanhogan/sSVCG/ http://jsfiddle.net/alanhogan/sSVCG/ (Also, HTML comments between elements apparently mess up IE7 and IE8.)
- StavrosK 14y ago"+ will select the immediately following sibling, ~ will select any (one?) subsequent sibling" is plenty clear, I think?