Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

HTML & CSS I just want the hover to change the colour of the button and the text.

littlemoon

New Coder
This is the css code I have. The problem is that the change takes place separately, if i was to hover over just the button, it changes just the button to blue which makes the text invisible as its original colour is blue. I tried making the padding of the text bigger so that its the same size of the button so that difference doesn't occur but it shifts the position of the text which isn't good. I'm sure there is an easier way of doing this that I'm missing? Im new to this.
CSS:
button {
    border: solid thin #071F4F;
    border-radius: 1%;
    padding: 2%;
    background-color:#CAD0D1;
    text-align: center;
    position: absolute;
    left: 38%;
    top: 60%;
    width: 18vw;
    font-size: 90%;
 
}

button a {
    color: #071F4F;
    text-decoration: none;
    letter-spacing: 1vw;
    padding: 5vh 20vh;
         
}

button a:hover {
    color:#CAD0D1;
    transition: 0.5s;
}

button:hover {
    background-color:#071F4F;
    transition: 0.5s;
}
 
Last edited by a moderator:
Replace:
CSS:
button a:hover {
    color:#CAD0D1;
    transition: 0.5s;
}
with this:
CSS:
button:hover a {
    color:#CAD0D1;
    transition: 0.5s;
}
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom