I have multiple paragraphs on a website and I want to change the color and font-weight of certain parts of each paragraph. Is there a way I can style multiple parts of multiple paragraphs without having to use ‘span’ & ‘strong’ for each and every single piece of text?>
Check out the :nth-child
pseudo-selector:
li:nth-child(2n) {
background: #CCC;
}
li:nth-child(2) {
background: #CCC;
}
If you don’t have seperate elements at all you would need some Javascript.
1 Like