我非常感谢您对此问题的任何帮助,我无法理解。
这是我使用的代码:
<head>
.probtn {
border-color: #282E34;
color: #282E34;
}
.probtn:hover {
background-color: #282E34;
color: white;
transition: all 0.3s;
transform-origin: bottom;
box-shadow: 0px 5px 5px 0px gray;
transform: translate(0px,-5px);
-webkit-transform: translate(0px,-5px);
-moz-transform: translate(0px,-5px);
-ms-transform: translate(0px,-5px);
-o-transform: translate(0px,-5px);
}
.btn {
border: 2px solid #282E34;
background-color: white;
color: #282E34;
padding: 14px 28px;
font-size: 16px;
cursor: pointer;
border-radius: 5Px;
}
</head>
<Body>
<button class="btn probtn" type="button" onClick="kundenon()">Unsere Kunden</button>
</Body>
transition: all 0.3s;
类上定义.probtn
,而不是:hover
。否则,一旦悬停状态被删除,过渡属性也将被删除。 .probtn {
border-color: #282E34;
color: #282E34;
transition: all 0.3s; /* moved to base class instead of hover state */
transform-origin: bottom;
}
.probtn:hover {
background-color: #282E34;
color: white;
box-shadow: 0px 5px 5px 0px gray;
transform: translate(0px,-5px);
-webkit-transform: translate(0px,-5px);
-moz-transform: translate(0px,-5px);
-ms-transform: translate(0px,-5px);
-o-transform: translate(0px,-5px);
}
.btn {
border: 2px solid #282E34;
background-color: white;
color: #282E34;
padding: 14px 28px;
font-size: 16px;
cursor: pointer;
border-radius: 5Px;
}
<button class="btn probtn" type="button" onClick="kundenon()">Unsere Kunden</button>