Topic: CSS to change text color (Page 1 of 1) |
|
---|---|
Bipolar (III) Inmate From: las vegas, nevada, us |
![]() ok I know there is a way to change the back ground of a link |
Lunatic (VI) Inmate From: under the bed |
![]() I'm not entirely clear on what you're asking, or what you mean by "dynamically". code: .blockheader { color:grey; } .blockheader span { color:blue; }
code: <div class="blockheader">Who's <span>online?</span></div>
code: .blockheader { color:grey; } .blockheader em { color:blue; }
code: <div class="blockheader">Who's <em>online?</em></div>
|
Obsessive-Compulsive (I) Inmate From: |
![]() Don't forget your CSS2.1 selectors; you can't specify the first word, but you can select the first line or letter. Not that IE cares, but in case you did. |
Paranoid (IV) Inmate From: Florida |
![]() quote:
|
Paranoid (IV) Inmate From: Mexico |
![]() I thught we all were talking about events, like :hover :P |
Obsessive-Compulsive (I) Inmate From: |
![]() The question was akwardly phrased, but you can still use pseudoclasses (events, like :hover) and pseudoelements (DOM extensions, like first-letter) together, tmk, just not on the same element. The question was whether you could change the color of text within an element -- the only way to achieve this (without changing the markup) are those pseudoelements. |
Lunatic (VI) Inmate From: under the bed |
![]() quote:
|
Lunatic (VI) Inmate From: under the bed |
![]() quote:
|
Bipolar (III) Inmate From: las vegas, nevada, us |
![]() I guess I was just hoping there was a way for CSS to take a line with two works and make the second word a different color then the first but thinking about it, since I'm pulling the titles from a database I can do it with php. |
Bipolar (III) Inmate From: las vegas, nevada, us |
![]() I got it to work with php! |
Paranoid (IV) Inmate From: London |
![]() Hey DL I always thought you were American, or do you just like to speak/write the correct English? |
Lunatic (VI) Inmate From: under the bed |
![]() Yup, american. |