The general sibling combinator (~) separates two selectors and matches all iterations of the second element, that are following the first element (though not necessarily immediately), and are children of the same parent element. Output:

<!-- General Sibling Selector(element tilde element) div~p:- Selects every <p> elements that are preceded by a <div> element. -->
<!DOCTYPE html>
<html lang="en">
<head>    
    <title>General Sibling Selector</title>
    <style>
        div~p {
            color: aqua;
            background-color: black;
        }
    </style>
</head>
<body>
    <div>
        <footer>
            <p>Inside div</p>
        </footer>
        Here is no effect. because it is not defined in style sheet. Only defined div is a parent element of p.
        <p>Inside div</p>
        <p>Inside div</p>
    </div>
    <div>
        <span>Span Element</span>

    </div>
    <p>Outer Paragraph from div</p>
    <p>ljflsadjf</p>
</body>
</html>

Show Output :

ele tilde ele output
Related Topic :
Chemistry Formulas ListMaths Formulas List
What is LibreOffice? LibreOffice Impress Features ?LibreOffice Impress CCC Questions and Answer in Hindi 2022
CCC LibreOffice Calc Paper Questions with AnswersCCC NIELIT Quiz 2022
Interview Questions and Answers for ExperienceInterview Questions and Answers for Freshers
MCQ 
[social_share_button themes='theme1']

Leave a Comment