etoisarobot
etoisarobot

Reputation: 7794

How to change the content of a span using css hover?

I can set the text of a span with this css.

.tracking-true .tracking-button-text:before
{
    content:"Tracking";
}

But I would like to change the text on hover Something like this but I can't get it to work.

.tracking-true .tracking-button-text:hover
{
    content:"Untrack";
}

Can this be done in css?

Update: Much like Stackoverflow uses :hover to change the cursor to a pointer or change a background color as a ui hint I am trying to convey to the user the same thing. This element can be clicked on and something will happen. I don't feel this is an innaporopriate use of CSS.

Upvotes: 1

Views: 2189

Answers (1)

Daniel Williams
Daniel Williams

Reputation: 8885

Do this:

.tracking-true .tracking-button-text:before
{
    content:"Tracking";
}

.tracking-true .tracking-button-text:hover:before
{
    content:"Untrack";
}

Upvotes: 3

Related Questions