# Button disappears on hover

**URL:** <https://community.hubspot.com/t/button-disappears-on-hover/86816>\
**Category:** CMS Development\
**Tags:** css, html\
**Created:** [August 4, 2023, 9:19am UTC](https://community.hubspot.com/t/button-disappears-on-hover/86816 "2023-08-04T09:19:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![HBarden](https://avatars.discourse-cdn.com/v4/letter/h/278dde/32.png) [@HBarden](https://community.hubspot.com/u/HBarden)\
**Post date:** [August 4, 2023, 9:19am UTC](https://community.hubspot.com/t/button-disappears-on-hover/86816/1 "2023-08-04T09:19:11Z")

</div>

Hi,

I’ve having to write code into boxes as the template for this website isn’t great at all.

I’ve written in code for a button but on hover it disappears. Is anyone able to help me so the button doesn’t disappear on hover? I’ll paste the code I’ve used below and a link to the page where the button is. Thanks.

\<button onclick=“window.location.href=‘/contact’;”\>Book a Consultation\</button\>

[https://biild.co.uk/approach](https://biild.co.uk/approach)

---

<div class="post-metadata">

**Author:** ![coldrickjack](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/coldrickjack/32/6684_2.png) [@coldrickjack](https://community.hubspot.com/u/coldrickjack)\
**Post date:** [August 4, 2023, 9:23am UTC](https://community.hubspot.com/t/button-disappears-on-hover/86816/2 "2023-08-04T09:23:15Z")

</div>

Hi @HBarden,

It looks like the issue is to do with some CSS being applied to the button when a user is hovering over it. The rules can be found below. Notice the “background-color” being set to “transparent” and the “color” of the font being set to “#FFFFFF” or “white” giving the illusion the button has disappeared.

```lia-code-sample
button:hover, button:focus, .button:hover, .button:focus {
 font-family: Lato, sans-serif;
 font-style: normal;
 font-weight: normal;
 text-decoration: none;
 background-color: transparent;
 border: none;
 color: #FFFFFF;
}

```

To fix this you could modify the rule to omit the “background-color” attribute. Are you comfortable updating/modifying CSS?

---

<div class="post-metadata">

**Author:** ![HBarden](https://avatars.discourse-cdn.com/v4/letter/h/278dde/32.png) [@HBarden](https://community.hubspot.com/u/HBarden)\
**Post date:** [August 4, 2023, 9:27am UTC](https://community.hubspot.com/t/button-disappears-on-hover/86816/3 "2023-08-04T09:27:35Z")

</div>

Hi,

I’ve looked in the button CSS, this is all I see.

/\* Primary Button \*/

button,  
.button,  
.hs-button {  
align-items: center;  
cursor: pointer;  
display: inline-flex;  
letter-spacing: 0.05rem;  
line-height: 1.5;  
margin: 0;  
text-align: center;  
transition: color 0.15s linear;  
white-space: normal;  
}

button:hover,  
button:focus,  
.button:hover,  
.button:focus {  
transition: background-color 0.3s;  
}

/\* Simple Button \*/

.button.button--simple {  
background-color: transparent;  
border: none;  
padding: 0 !important;  
position: relative;  
}

.button.button--simple:after {  
left: 0;  
position: absolute;  
width: 100%;  
}

.button.button--simple:hover,  
.button.button--simple:focus {  
background-color: transparent;  
border: none;  
}

.button.button--simple:active {  
background-color: transparent;  
border: none;  
}

/\* Button Icons \*/

.button .button\_\_icon svg {  
display: block;  
fill: inherit;  
height: 1.25rem;  
margin-right: 1rem;  
}

.button.button--icon-right .button\_\_icon {  
order: 1;  
}

.button.button--icon-right .button\_\_icon svg {  
margin-left: 1rem;  
margin-right: 0;  
}

---

<div class="post-metadata">

**Author:** ![coldrickjack](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/coldrickjack/32/6684_2.png) [@coldrickjack](https://community.hubspot.com/u/coldrickjack)\
**Post date:** [August 4, 2023, 9:33am UTC](https://community.hubspot.com/t/button-disappears-on-hover/86816/4 "2023-08-04T09:33:28Z")

</div>

Hey @HBarden,

Can you modify the rule below in the CSS file:

```lia-code-sample
button:hover,
button:focus,
.button:hover,
.button:focus {
transition: background-color 0.3s;
}

```

to:

```lia-code-sample
button:hover,
button:focus,
.button:hover,
.button:focus {
transition: background-color 0.3s;
background-color: #12a987 !important;
}

```

---

<div class="post-metadata">

**Author:** ![HBarden](https://avatars.discourse-cdn.com/v4/letter/h/278dde/32.png) [@HBarden](https://community.hubspot.com/u/HBarden)\
**Post date:** [August 4, 2023, 9:37am UTC](https://community.hubspot.com/t/button-disappears-on-hover/86816/5 "2023-08-04T09:37:06Z")

</div>

I’ve done that, it still seems to disappear?

---

<div class="post-metadata">

**Author:** ![coldrickjack](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/coldrickjack/32/6684_2.png) [@coldrickjack](https://community.hubspot.com/u/coldrickjack)\
**Post date:** [August 4, 2023, 9:39am UTC](https://community.hubspot.com/t/button-disappears-on-hover/86816/6 "2023-08-04T09:39:04Z")

</div>

Hey @HBarden,

It is working, it’s just that your previous CSS has been cached in your browser. You can clear the cache or just append a parameter to the URL to force the cache to clear.

---

<div class="post-metadata">

**Author:** ![HBarden](https://avatars.discourse-cdn.com/v4/letter/h/278dde/32.png) [@HBarden](https://community.hubspot.com/u/HBarden)\
**Post date:** [August 4, 2023, 9:43am UTC](https://community.hubspot.com/t/button-disappears-on-hover/86816/7 "2023-08-04T09:43:52Z")

</div>

Thank you very much for your help. Much appreciated!

---

<div class="post-metadata">

**Author:** ![HBarden](https://avatars.discourse-cdn.com/v4/letter/h/278dde/32.png) [@HBarden](https://community.hubspot.com/u/HBarden)\
**Post date:** [August 4, 2023, 9:38am UTC](https://community.hubspot.com/t/button-disappears-on-hover/86816/8 "2023-08-04T09:38:24Z")

</div>

Sorry I’ve just refreshed again and it has worked, thank you!
