Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change font color across divs and spans

Tags:

html

css

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.

like image 670
Uno Mein Ame Avatar asked Oct 08 '11 04:10

Uno Mein Ame


1 Answers

Always wrap the text like in your example in span tag. Don't throw the text like that. With that said, in general you can specify in .css file color property for span.

span{ color: Red }

But if you want specific span in a div to have a specific color then -

<div class="someClass">
    <span>some text</span>
</div>

In .css,

.someClass { /* properties for the div */ }
.someClass span { color: Blue; /* other font properties */ }
like image 124
Mahesh Avatar answered Sep 30 '22 23:09

Mahesh