views:

206

answers:

7

I've just learned how to make a text to blink (<div style="text-decoration:blink">text</div>).

How about the other decoration modes such as color changing? Are they available in CSS?

Thanks.

A: 

No, these are generally programmed using JavaScript.

If you are referring to link color changing on hover, that is done with css.

a:link { color: blue; }
a:hover { color: green; }
Daniel A. White
You can add color, see Patrice's answer
xav0989
Yes, but i thought the OP wanted to change the colors like blinking the color back and forth.
Daniel A. White
+3  A: 

Nothing too interesting with text-decoration. A good resource is always the w3:
http://www.w3schools.com/Css/pr_text_text-decoration.asp

h1 {text-decoration:overline}
h2 {text-decoration:line-through}
h3 {text-decoration:underline}
h4 {text-decoration:blink}

Regarding your second question - of course. CSS can (and should) be used to style almost anything, though blinking text is an extreme example, most rules are much more useful.

Kobi
+1  A: 

Yes, color changing is available in CSS. Use

<div style="color:red">foo</div>

for example. You probably want to check out a good CSS introduction or the official standard:

Patrice
+1  A: 

The available text-decoration values are:

  • blink
  • line-through
  • none
  • overline
  • underline

See http://reference.sitepoint.com/css/text-decoration for more details.

jhurshman
+1  A: 

Yes, you can use the following:

color: #FFFFFF; (which would make your text white in color)

font-weight:bold;

text-decoration:underline;

etc.

You should really Google this.

Anriëtte Combrink
+1 for google.
peirix
+1  A: 

I suppose that by color changing you don’t mean just to set the text color as color does but more complex animations.

There are some experiments like WebKit’s -webkit-animation, -webkit-transform or -webkit-transition. But those properties are proprietary.

Nowadays such effects are done with the help of JavaScript. There are plenty JavaScript frameworks you can use like jQuery, mootools, Prototype, Script.aculo.us, etc.

Gumbo
Off topic: Gumbo, can you please accept your nomination for moderator: http://meta.stackoverflow.com/questions/35583/nominations-new-stack-overflow-moderator/35598#35598
Sam152