CSS Combinators
- turned_in_notCombinator Selectors
- descendant selector [space]
- child selector [>]
- adjacent sibling selector [+]
- general sibling selector [~]
descendant selector [space]
It selects all elements that are descendants of a specified element
/*Syntax*/
specified_Selector select_Selector{
/*css properties*/
}
*descendant: can be child, grand-child, grand-grandchild and so on
<p> I am inside div</p>
</div><div id="test">
<p> I am inside div_id_test</p>
</div>Try below options to see comment
child selector [>]
It selects all elements that are the direct child of a specified element
/*Syntax*/
specified_Selector > select_Selector{
/*css properties*/
}
<p> I am inside div</p>
</div><div id="test">
<p> I am inside div_id_test</p>
</div>Try below options to see comment
adjacent sibling selector [+]
It selects all elements that are placed immediately after a specified element
/*Syntax*/
specified_Selector + select_Selector{
/*css properties*/
}
<p>Hello my friends!</p>
<div id="test"></div><p>Good Luck !</p>
<p>Well Done !</p>
Try below options to see comment
general sibling selector [~]
It selects all elements that are siblings of a specified element and declared after it
/*Syntax*/
specified_Selector ~ select_Selector{
/*css properties*/
}
*siblings: Sharing same parent
<p>Well Done !</p>
<div></div><p>Hello my friends!</p>
<div id="test"></div><p>Good Luck !</p>
<p>Well Done !</p>
Try below options to see comment