Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

How to select every <p> element that is the only child of its parent ?

user-image
Question added by doaa elsayed , معلم حاسب ألى , مدرسة الأنفوشى الرسمية (لغات)
Date Posted: 2017/04/10
medhatmahmoud mahmoud
by medhatmahmoud mahmoud , Web Designer , Connect Computer Service Co

<!DOCTYPE html>

<html>

<head>

<style> 

p:only-child {

    background: red;

}

</style>

</head>

<body>

 

<div><p>This is a paragraph.</p></div>

 

<div><span>This is a span.</span><p>This is a paragraph.</p></div>

 

</body>

</html>

 

More Questions Like This