From the below code: why paragraph tag not showing green? Iam just practising CSS, so I came across with this doubt..
p .marked2{
color:green;
}
.marked p
{
color:purple;
}
<p class="marked2">This is a green paragraph.</p> //HERE NOT SHOWING GREEN
<div class="marked">
<p>This is a purple paragraph.</p> //HERE GETTING PURPLE COLOR
</div>
please clear me this..
Should be
p.marked2. The way you have it now, it’s looking for.marked2elements inside of anypcontainer.Examples:
p.marked2will target<p class="marked2">...</p>(everypelement withclass="marked2")p .marked2will target<p><span class="marked2">...</span></p>(any kind of element withclass="marked2"as any descendent of<p>)