Reputation: 157
So lets say we have N children and we want to use a selector to color them all expect the first child. Is there any possible way to do that without the use of :not(...) pseudo class?? The example is this:
<!DOCTYPE html>
<html>
<head>
<style>
p:not(:first-child){
background: #ff0000;
}
</style>
</head>
<body>
<div><p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
</div>
</body>
</html>
This selects and colors red all children expect the first but i want to do that without the use of :not() .Is there way to do that?
Upvotes: 1
Views: 1785
Reputation: 325
Do it the opposite way round?
<style>
p {background:#ff0000;}
p:first-child {background:none;}
</style>
Upvotes: 1