vendredi 2 juillet 2021

Background color of the button not changing completely when hovered

I have been working on a button that has to changes it's background color when we hover the mouse on it. But Unfortunately i couldn't achieve that. The Color change is only limited upto the text. But i want it to be for the entire button's background. I have attached 2 Images that depict my exact problem.

Before

Before Hovering on the Button

After

After Hovering on the Button

Here as you can see the button's background color isn't completely changing.

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300&display=swap');
body {
  background-color: white;
  display: flex;
  justify-content: center;
}

.button {
  border: 2px solid blueviolet;
  height: 30px;
  width: 70px;
  justify-content: center;
  align-items: center;
  display: flex;
  border-radius: 5%;
  margin-top: 50%;
}

.text a {
  text-decoration: none;
  color: blueviolet;
  font-family: montserrat, sans-serif;
  font-weight: 600;
}

.text :hover {
  color: white;
}

.button :hover {
  background-color: blueviolet;
}
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial- 
            scale=1.0">
  <title>Buttons</title>
  <link rel="shortcut icon" href="./Assets/Images/Button.png" type="image/x-icon">
  <link rel="stylesheet" href="style.css">
</head>

<body>

  <div class="button">
    <p class="text">
      <a href="#">Click</a>
    </p>
  </div>

</body>

</html>



Aucun commentaire:

Enregistrer un commentaire