Skip to content Skip to sidebar Skip to footer

Css Transition Hover Effect For Touch Devices

I'm trying to get a hover/ touch effect when I tap a button using CSS. I have used the below CSS transition to change the background, but it doesn't seem to work: https://jsfiddle.

Solution 1:

Your background-image: -moz-linear-gradient( 90deg, rgb(170,34,23) 0%, rgb(170,34,23) 0%, rgb(195,51,39) 22%, rgb(219,68,55) 100%); is overriding the background-color in the :hover state.

If you loose the background-image, it will work:

.ico-btn {
    -webkit-user-select: none; margin-right: 0px;
    -webkit-box-shadow: rgba(0, 0, 0, 0.298039) 0px2px10px0px, rgba(0, 0, 0, 0.0980392) 0px0px1px0px, rgba(255, 255, 255, 0.247059) 0px1px0px0px inset, rgba(0, 0, 0, 0.14902) 0px -1px0px0px inset;
    -webkit-font-smoothing: antialiased;
    border-bottom-left-radius: 25%;
    border-bottom-right-radius: 25%;
    border-top-left-radius: 25%;
    border-top-right-radius: 25%;
    box-shadow: rgba(0, 0, 0, 0.298039) 0px2px10px0px, rgba(0, 0, 0, 0.0980392) 0px0px1px0px, rgba(255, 255, 255, 0.247059) 0px1px0px0px inset, rgba(0, 0, 0, 0.14902) 0px -1px0px0px inset;
    cursor: pointer;
    display: block;
    font-family: Roboto, Arial, sans-serif;
    font-size: 140px;
    font-weight: normal;
    height: 177px; /*167px;*/line-height: 150px;
    min-width: 0px;
    padding: 40px000; /*30*/text-align: center;
    white-space: nowrap;
    width: 220px;/*200*/z-index: 2;
    margin: 0 auto;
    color:#fff;
}

.ico-btn.red { background-color: rgb(219, 68, 55);
    border-bottom-color:#ab2318;
    border-bottom-left-radius: 25%;
    border-bottom-right-radius: 25%;
    border-bottom-style: solid;
    border-bottom-width: 1px;
    border-left-color: rgb(0, 0, 0);
    border-left-style: none;
    border-left-width: 0px;
    border-right-color: rgb(0, 0, 0);
    border-right-style: none;
    border-right-width: 0px;
    border-top-color:#ef675c;
    border-top-left-radius: 25%;
    border-top-right-radius: 25%;
    border-top-style: solid;
    border-top-width: 2px;
    transition: all .1s linear;
}
.ico-btn.red:hover {
	background-color: #D05944;
	-webkit-transition: background-color .25s ease-in-out;
	-moz-transition: background-color .25s ease-in-out;
	-o-transition: background-color .25s ease-in-out;
	transition: background-color .25s ease-in-out;
}
<divrole="button"class="ico-btn red"><spanclass="icon-sad"></span></div>

Solution 2:

In ico-btn.red remove following lines as they override hover state:

background-color: rgb(219, 68, 55);
    background-image: -moz-linear-gradient( 90deg, rgb(170,34,23) 0%, rgb(170,34,23) 0%, rgb(195,51,39) 22%, rgb(219,68,55) 100%);
    background-image: -webkit-linear-gradient( 90deg, rgb(170,34,23) 0%, rgb(170,34,23) 0%, rgb(195,51,39) 22%, rgb(219,68,55) 100%);
    background-image: -ms-linear-gradient( 90deg, rgb(170,34,23) 0%, rgb(170,34,23) 0%, rgb(195,51,39) 22%, rgb(219,68,55) 100%);

Post a Comment for "Css Transition Hover Effect For Touch Devices"