Adjacent Sibling Selector
Adjacent Sibling Selector किसी HTML tag के adjacent siblings को select करने के लिए use किया जाता है। यहा दोनों elements के बीच मे “+” symbol का use होता है। जब दो elements एक दूसरे के पहले या बाद मे आते है मतलब की एक दूसरे से सटे हुए रहते है तब वो elements adjacent कहलाते है।
Adjacent Sibling Selector
Adjacent Sibling Selector is used to select adjacent siblings of an HTML tag. Here “+” symbol is used between the two elements. When two elements come before or after each other, that is, they are adjacent to each other, then those elements are called adjacent.
Example:
<html> <head> <style> p+span { background:green; } </style> </head> <body> <div id=”myDiv”> <p>This is a paragraph</p> <span>This span is adjacent sibling of above paragraph</span> <span>This span is sibling but not adjacent sibling of above paragraph</span> </div> </body> </html> |