is it possible to change font color across several divs and spans with css?
For example, I have HTML that goes like this:
some text ### some text
<div> some text in div</div>
some text
<div> some text
<span>some text</span>
</div>
some ### more text
Is there a way to change the color of the text to, let’s say, red between the ### marks?
PS. The question is not about scripting, the question about the resulting markup/css itself.
I’m not exactly sure what you’re asking, so let’s take the opportunity to go over some CSS basics:
This CSS will apply to all
divtags:This CSS will apply to all
spantags inside adiv:This CSS will apply to all
divtags and allspantags:If you want a CSS rule to apply to a certain section of code regardless of the elements in it, then you can put it in a wrapper, like so:
Then, you can apply this CSS rule to match all tags of any type inside a
divwith classWrapper: