r/csshelp • • Oct 07 '15

Brighten Link button on hover only.

I tried using this code:

a {
  color:blue; background:white;
  -o-transition:color .2s ease-out, background 1s ease-in;
  -ms-transition:color .2s ease-out, background 1s ease-in;
  -moz-transition:color .2s ease-out, background 1s ease-in;
  -webkit-transition:color .2s ease-out, background 1s ease-in;
  /* ...and now override with proper CSS property */
  transition:color .2s ease-out, background 1s ease-in;
}
a:hover { color:red; background:yellow; }

for /r/randomgifts. But it made everything that's selectable do this, in addition to giving it a white background. It's a cool effect, but I would like for only the Submit Link button background only to change color to #ABFAFA

Thanks.

edit the only element I want this to affect is the submit button. Nothing in the header or any other text should be affected.

7 Upvotes

14 comments sorted by

1

u/ForScale Oct 07 '15

Try using this to select div.sidebox.submit.submit-link.

1

u/ImprovementDept Oct 07 '15

div.sidebox.submit.submit-link

Can you tell me where I place that exactly? I'm not clear on the spacing or placement.

1

u/ForScale Oct 07 '15

At the bottom of your stylesheet, exactly as I wrote it:

div.sidebox.submit.submit-link {
  /*css code goes under this line*/
}

1

u/MakingTheEight Oct 08 '15
.submit-link .morelink {
  background:white;
  -o-transition:color .2s ease-out, background 1s ease-in;
  -ms-transition:color .2s ease-out, background 1s ease-in;
  -moz-transition:color .2s ease-out, background 1s ease-in;
  -webkit-transition:color .2s ease-out, background 1s ease-in;
  transition:color .2s ease-out, background 1s ease-in;
}
.submit-link .morelink:hover { 
    background:#ABFAFA;
 }

 .submit-link .morelink a {
  color:blue; /*link color*/
}
.submit-link .morelink:hover a {
    color: #ff0000 /*link color on hover*/
}

1

u/ImprovementDept Oct 08 '15 edited Oct 08 '15

This is somewhat closer, however, it doesn't fade in an out on hover. Also, this doesn't change the background of the Submit button, rather, it changes the text.. which I think I prefer.

1

u/MakingTheEight Oct 08 '15

it doesn't fade in and out on hover

What exactly did you want?
Because it does that for me.

doesn't change the background of the submit button.

Huh?
On hover it changes to a light blue color for me, and the text to red.

Can you explain the exact problem you're having?

1

u/ImprovementDept Oct 08 '15

Red? Lol I don't see that at all. Maybe it's an RES thing for me or something. I just don't know. One version of code does the fade in out thing, but messes up all the other buttons. Your version just straight highlights the text to blue. Idk

1

u/MakingTheEight Oct 08 '15 edited Oct 09 '15

You don't see the red because you changed #ff0000 to #ABFAFA, which makes the text that blue shade(#ABFAFA) on hover.

What do you want?
Because I don't understand what it is you want.

Remove this block of code in your stylesheet first:

.submit-link a {
    background-color: #009fbf
 }

1

u/ImprovementDept Oct 09 '15

Well right now.. the white text of the Link button goes to that blue color I changed it to immediately. Which is fine. I like that.

I want it to fade from white to that blue color upon hover. I, however, do not see it doing that on my end.. but if others do, then that is all that matters.

1

u/MakingTheEight Oct 09 '15

I'm confused.

What do you want to fade?
The background color, or the text color?

1

u/ImprovementDept Oct 09 '15 edited Oct 09 '15

I want the text to fade in from white to that blue.

edit Originally, I had wanted the background of the link button to fade to that brighter blue. What happened was, IMO, a fortunate mistake, as I now like the text fading to blue. Sorry for the confusion. Ideally, the border of the button would also do the same.

2

u/MakingTheEight Oct 09 '15 edited Oct 09 '15
.submit.submit-link .morelink a.login-required{
    color: white;
    -webkit-transition: color 1s ease-in-out;
    transition: color 1s ease-in-out;
}

.submit.submit-link .morelink:hover a.login-required {
    color: #abfafa
}

.submit.submit-link .morelink {
    border: 2px solid;
    border-color: #FE0000;
    -webkit-transition: border-color 1s ease-in-out;
    transition: border-color 1s ease-in-out;
}

.submit.submit-link .morelink:hover {
    border-color: #abfafa
}

I don't know if you wanted the fade in to occur when you hover on the link itself, or on just the box. I've made it happen when you hover on the box, if you want it to occur only when you hover on the link, mover the hover state to the a element.
If you want to make the fade in faster/slower, change the 1s value. > 1 results into a slower fading, < 1 results into a faster effect.

I made the borders #fe0000, because if they're white they blend into the sidebar.
You can change the colors to what you want.

Is that what you want?

1

u/ImprovementDept Oct 09 '15

Yes, thank you very much!

1

u/MatthewMob Oct 07 '15
a.login-required:hover {
    color: #ABFAFA;
}