css实现50余种按钮悬浮效果代码
代码语言:html
所属分类:悬停
代码描述:css实现50余种按钮悬浮效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> .button { margin: 0.4em; padding: 1em; cursor: pointer; background: #ececec; text-decoration: none; color: #666; } /* 2D TRANSITIONS */ /* Grow */ .grow { display: inline-block; transition-duration: 0.3s; transition-property: transform; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); transform: translateZ(0); box-shadow: 0 0 1px rgba(0, 0, 0, 0); } .grow:hover { transform: scale(1.1); } /* Shrink */ .shrink { display: inline-block; transition-duration: 0.3s; transition-property: transform; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); transform: translateZ(0); box-shadow: 0 0 1px rgba(0, 0, 0, 0); } .shrink:hover { transform: scale(0.9); } /* Pulse */ @keyframes pulse { 25% { transform: scale(1.1); } 75% { transform: scale(0.9); } } .pulse { display: inline-block; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); transform: translateZ(0); box-shadow: 0 0 1px rgba(0, 0, 0, 0); } .pulse:hover { animation-name: pulse; animation-duration: 1s; animation-timing-function: linear; animation-iteration-count: infinite; } /* Pulse Grow */ @keyframes pulse-grow { to { transform: scale(1.1); } } .pulse-grow { display: inline-block; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); transform: translateZ(0); box-shadow: 0 0 1px rgba(0, 0, 0, 0); } .pulse-grow:hover { animation-name: pulse-grow; animation-duration: 0.3s; animation-timing-function: linear; animation-iteration-count: infinite; animation-direction: alternate; } /* Pulse Shrink */ @keyframes pulse-shrink { to { transform: scale(0.9); } } .pulse-shrink { display: inline-block; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); transform: translateZ(0); box-shadow: 0 0 1px rgba(0, 0, 0, 0); } .pulse-shrink:hover { animation-name: pulse-shrink; animation-duration: 0.3s; animation-timing-function: linear; animation-iteration-count: infinite; animation-direction: alternate; } /* Push */ @keyframes push { 50% { transform: scale(0.8); } 100% { transform: scale(1); } } .push { display: inline-block; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); transform: translateZ(0); box-shadow: 0 0 1px rgba(0, 0, 0, 0); } .push:hover { animation-name: push; animation-duration: 0.3s; animation-timing-function: linear; animation-iteration-count: 1; } /* Pop */ @keyframes pop { 50% { transform: scale(1.2); } 100% { transform: scale(1); } } .pop { display: inline-block; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); transform: translateZ(0); box-shadow: 0 0 1px rgba(0, 0, 0, 0); } .pop:hover { animation-name: pop; animation-duration: 0.3s; animation-timing-function: linear; animation-iteration-count: 1; } /* Rotate */ .rotate { display: inline-block; transition-duration: 0.3s; transition-property: transform; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); transform: translateZ(0); box-shadow: 0 0 1px rgba(0, 0, 0, 0); } .rotate:hover { transform: rotate(4deg); } /* Grow Rotate */ .grow-rotate { display: inline-block; transition-duration: 0.3s; transition-property: transform; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); transform: translateZ(0); box-shadow: 0 0 1px rgba(0, 0, 0, 0); } .grow-rotate:hover { transform: scale(1.1) rotate(4deg); } /* Float */ .float { display: inline-block; transition-duration: 0.3s; transition-property: transform; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); transform: translateZ(0); box-shadow: 0 0 1px rgba(0, 0, 0, 0); } .float:hover { transform: translateY(-5px); } /* Sink */ .sink { display: inline-block; transition-duration: 0.3s; transition-property: transform; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); transform: translateZ(0); box-shadow: 0 0 1px rgba(0, 0, 0, 0); } .sink:hover { transform: translateY(5px); } /* Hover */ @keyframes hover { 50% { transform: translateY(-3px); } 100% { transform: translateY(-6px); } } .hover { display: inline-block; transition-duration: 0.5s; transition-property: transform; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); transform: translateZ(0); box-shadow: 0 0 1px rgba(0, 0, 0, 0); } .hover:hover { transform: translateY(-6px); animation-name: hover; animation-duration: 1.5s; animation-delay: 0.3s; animation-timing-function: linear; animation-iteration-count: infinite; animation-direction: alternate; } /* Hang */ @keyframes hang { 50% { transform: translateY(3px); } 100% { transform: translateY(6px); } } .hang { display: inline-block; transition-duration: 0.5s; transition-proper.........完整代码请登录后点击上方下载按钮下载查看
网友评论0