Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,971 questions

51,913 answers

573 users

How to apply css to a <p> tag inside <div> tag with CSS and HTML

4 Answers

0 votes
<!DOCTYPE html>
<html>
<head>
<style>
.div-p div:nth-child(1) p{color:blue;}
</style>
</head>
<body>

<div class="div-p">
    <div>
        <p>div p style</p>  
    </div>
</div>

</body>
</html>

 



answered Jul 31, 2018 by avibootz
0 votes
<!DOCTYPE html>
<html>
<head>
<style>
.div-p div:nth-child(1) p{color:blue;}
.div-p div:nth-child(2) p{color:green;}
.div-p div:nth-child(3) p{color:red;}
</style>
</head>
<body>

<div class="div-p">
    <div>
        <p>div p style 1</p>  
    </div>    
    <div>
        <p>div p style 2</p>  
    </div>    
    <div>
        <p>div p style 3</p>  
    </div>
</div>

</body>
</html>

 



answered Jul 31, 2018 by avibootz
0 votes
<!DOCTYPE html>
<html>
<head>
<style>
.div-p > div > p {
    color: green;
}
</style>
</head>
<body>

<div class="div-p">
    <div>
        <p>div p style 1</p>  
    </div>    
    <div>
        <p>div p style 2</p>  
    </div>    
    <div>
        <p>div p style 3</p>  
    </div>
</div>

</body>
</html>

 



answered Jul 31, 2018 by avibootz
0 votes
<!DOCTYPE html>
<html>
<head>
<style>
.div-p div:nth-child(2) p{color:green;}
</style>
</head>
<body>
 
<div class="div-p">
    <div>
        <p>div p style 1</p>  
    </div>    
    <div>
        <p>div p style 2</p>  
    </div>    
    <div>
        <p>div p style 3</p>  
    </div>
</div>
 
</body>
</html>

 



answered Jul 31, 2018 by avibootz

Related questions

1 answer 228 views
1 answer 190 views
190 views asked Dec 18, 2018 by avibootz
2 answers 270 views
1 answer 214 views
2 answers 287 views
2 answers 278 views
2 answers 288 views
...