Hover
na podstawie webdesignerdepot.com
wspólne własności
a {
display: block;
transition: all 0.3s ease;
}
Code language: CSS (css)
KLIKNIJ na poszczególne buttony, aby zobaczyć pozostałe zapisy html i css
<a href="#" class="item-1">border</a> .item-1:hover { box-shadow: inset 0 0 0 15px white; }
<a href="#" class="item-2">bg color</a> .item-2:hover { background: white; }
<a href="#" class="item-3">fade</a> .item-3:hover { opacity: 0.5; }
<a href="#" class="item-4">grow</a> .item-4:hover { transform: scale(1.3); }
<a href="#" class="item-5">rotate</a> .item-5:hover { transform: rotateZ(-30deg); }
<a href="#" class="item-6">shadow</a> .item-6:hover { box-shadow: 1px 1px white, 2px 2px white, 3px 3px white; transform: translateX(-3px); }
<a href="#" class="item-7">shrink</a> .item-7:hover { transform: scale(0.8); }
<a href="#" class="item-8">swing</a> .item-8:hover { animation: swingWOW 1s ease; animation-iteration-count: 1; } @keyframes swingWOW { 15% { transform: translateX(5px); } 30% { transform: translateX(-5px); } 50% { transform: translateX(3px); } 65% { transform: translateX(-3px); } 80% { transform: translateX(2px); } 100% { transform: translateX(0); } }
<a href="#" class="item-9">to circle</a> .item-9:hover { border-radius: 50%; }
Na podstawie html5canvastutorials.com
wspólne własności css
a.ex {
width: 120px;
height: 52px;
margin-bottom: 80px;
color: black;
display: block;
position: relative;
box-sizing: border-box;
}
a.ex span {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: block;
box-sizing: border-box;
display: grid;
place-content: center;
}
Code language: CSS (css)
Flip
Flip
<a href="#" class="ex ex-1"> <span>Flip</span> <span>Flip</span> </a>
css
.ex-1 { background: #289DCC; } .ex-1 span { background: #289DCC; transition: all 0.3s linear; } .ex-1 span:last-of-type { background: #aaa; transform: rotateX(90deg); transform-origin: 0 0; } .ex-1:hover span:last-of-type { background: #fff; transform: rotateX(0deg); } .ex-1:hover span:first-of-type { background: #289DCC; }
Top
Top
<a href="#" class="ex ex-4"> <span><span> <span>Top</span> <span>Top</span> </span></span> </a>
css
.ex-4 > span > span { transform-style: preserve-3d; transition: all 0.2s linear; transform-origin: 0 0; } .ex-4 > span > span span { background: #289DCC; transform-style: preserve-3d; transition: transform 0.3s linear, background 0.3s linear; transform-origin: 0 0; } .ex-4:hover > span > span span:first-of-type { background: #289DCC; } .ex-4 > span > span span:nth-of-type(2) { background: #fff; transform: rotateX(-90deg) translateZ(52px); } .ex-4:hover > span > span span:nth-of-type(2) { background: #fff; } .ex-4:hover > span > span { transform: rotateX(90deg); }
Doors
Doors
Doors
Doors
<a href="#" class="ex ex-2"> <span>Doors</span> <span>Doors</span> <span>Doors</span> <span>Doors</span> </a>
css
.ex-2 { background: #289DCC; } .ex-2 span { opacity: 1; transition: all 0.3s linear; } .ex-2 span:nth-of-type(2), .ex-2 span:nth-of-type(3) { background: #fff; transform: rotateY(-90deg); transform-origin: 0 0; clip: rect(0, 60px, 9999px, 0); } .ex-2 span:nth-of-type(3) { transform-origin: 100% 100%; transform: rotateY(90deg); clip: rect(0, 9999px, 9999px, 60px); } .ex-2:hover span:nth-of-type(2), .ex-2:hover span:nth-of-type(3) { background: #fff; transform: rotateY(0); } .ex-2:hover span:nth-of-type(2), .ex-2:hover span:nth-of-type(3) { background: #fff; transform: rotateY(0); } .ex-2:hover span:first-of-type { background: #289DCC; } .ex-2 span:last-of-type { background: #fff; opacity: 0; transition: none; } .ex-2:hover span:last-of-type { transition: all 0.05s linear 0.3s; }
Arrow
<a href="#" class="ex ex-5"> <span>Arrow</span> <span> </span> <span> </span> <span> </span> <span> </span> </a>
css
.ex-5 span { background: #289DCC; transform-style: preserve-3d; transform-origin: 0 0; transition: all 0.1s linear; } .ex-5 span:nth-of-type(1) { z-index: 99999; } .ex-5:hover span:nth-of-type(5) { left: 40px; } .ex-5 span:nth-of-type(2), .ex-5 span:nth-of-type(3), .ex-5 span:nth-of-type(4) { background: none; } .ex-5 span:nth-of-type(2):after { content: ''; position: absolute; right: 0; top: 0; border-style: solid; border-width: 28px 0 0 28px; border-color: transparent transparent transparent #289DCC; } .ex-5 span:nth-of-type(3):after { content: ''; position: absolute; bottom: 0; right: 0; border-style: solid; border-width: 28px 28px 0 0; border-color: #289DCC transparent transparent #289DCC; } .ex-5 span:nth-of-type(4):after { content: ''; position: absolute; top: 0; right: 0; border-style: solid; border-width: 26px 0 26px 23px; border-color: transparent transparent transparent #289DCC; } .ex-5:hover span:nth-of-type(2) { top: -28px; left: 40px; } .ex-5:hover span:nth-of-type(3) { top: 28px; left: 40px; } .ex-5:hover span:nth-of-type(4) { right: -23px; left: 63px; }
Open
Open
Open
<a href="#" class="ex ex-3"> <span>Open</span> <span>Open</span> <span>Open</span> </a>
css
.ex-3 { background: #fff; transition: transform 0.3s linear, background 0.3s linear 0.3s; } .ex-3 span { transition: all 0.3s linear 0.3s; } .ex-3:hover { background: #fff; transform: scale(1.3); } .ex-3 span:nth-of-type(2), .ex-3 span:nth-of-type(3) { background: #289DCC; clip: rect(0px, 9999px, 26px, 0px); transform-origin: 0 0; } .ex-3 span:nth-of-type(3) { clip: rect(26px, 9999px, 52px, 0px); transform-origin: 100% 100%; } .ex-3:hover span:nth-of-type(2), .ex-3:hover span:nth-of-type(3) { background: #289DCC; transform: rotateX(-90deg); }
Fill
<a href="#" class="ex ex-6"> <span>Fill</span> <span> </span> </a>
css
.ex-6 { background: #289DCC; overflow: hidden; } .ex-6 span { transform-style: preserve-3d; transform-origin: 0 0; transition: all 0.6s cubic-bezier(0.05, 0.06, 0.05, 0.95); } .ex span:first-of-type { z-index: 99999; } .ex-6 span:last-of-type { background: #fff; left: -100%; } .ex-6:hover span { left: 0; }
Na podstawie ianlunn.co.uk
wspólne własności css
a { color: black; font-size: 14px; width: 180px; margin: 7px; padding-top: 10px; padding-bottom: 10px; cursor: pointer; display: block; text-align: center; text-decoration: none; } a:focus, a:hover, a:active { color: white; }
KLIKNIJ na poszczególne buttony, aby zobaczyć pozostałe zapisy html i css
2D Transitions
HTML:
<a href="#" class="hvr-grow">Grow</a>
CSS:
.hvr-grow {
background: #289DCC;
transform: perspective(1px) translateZ(0);
transition-duration: 0.3s;
transition-property: transform;
}
.hvr-grow:focus,
.hvr-grow:hover,
.hvr-grow:active {
transform: scale(1.1);
}
HTML:
<a href="#" class="hvr-shrink">Shrink</a>
CSS:
.hvr-shrink {
background: #289DCC;
transform: perspective(1px) translateZ(0);
transition-duration: 0.3s;
transition-property: transform;
}
.hvr-shrink:focus,
.hvr-shrink:hover,
.hvr-shrink:active {
transform: scale(0.9);
}
HTML:
<a href="#" class="hvr-pulse">Pulse</a>
CSS:
.hvr-pulse {
background: #289DCC;
transform: perspective(1px) translateZ(0);
}
.hvr-pulse:focus,
.hvr-pulse:hover,
.hvr-pulse:active {
animation-name: hvr-pulse;
animation-duration: 1s;
animation-timing-function: linear;
animation-iteration-count: infinite;
}
@keyframes hvr-pulse {
25% { transform: scale(1.1); }
75% { transform: scale(0.9); }
}
HTML:
<a href="#" class="hvr-pulse-grow">Pulse Grow</a>
CSS:
.hvr-pulse-grow {
background: #289DCC;
transform: perspective(1px) translateZ(0);
}
.hvr-pulse-grow:focus,
.hvr-pulse-grow:hover,
.hvr-pulse-grow:active {
animation-name: hvr-pulse-grow;
animation-duration: 0.3s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
@keyframes hvr-pulse-grow {
to { transform: scale(1.1); }
}
HTML:
<a href="#" class="hvr-pulse-shrink">Pulse Shrink</a>
CSS:
.hvr-pulse-shrink {
background: #289DCC;
transform: perspective(1px) translateZ(0);
}
.hvr-pulse-shrink:focus,
.hvr-pulse-shrink:hover,
.hvr-pulse-shrink:active {
animation-name: hvr-pulse-shrink;
animation-duration: 0.3s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
@keyframes hvr-pulse-shrink {
to { transform: scale(0.9); }
}
HTML:
<a href="#" class="hvr-push">Push</a>
CSS:
.hvr-push {
background: #289DCC;
transform: perspective(1px) translateZ(0);
}
.hvr-push:focus,
.hvr-push:hover,
.hvr-push:active {
animation-name: hvr-push;
animation-duration: 0.3s;
animation-timing-function: linear;
animation-iteration-count: 1;
}
@keyframes hvr-push {
50% { transform: scale(0.8); }
100% { transform: scale(1); }
}
HTML:
<a href="#" class="hvr-pop">Pop</a>
CSS:
.hvr-pop {
background: #289DCC;
transform: perspective(1px) translateZ(0);
}
.hvr-pop:focus,
.hvr-pop:hover,
.hvr-pop:active {
animation-name: hvr-pop;
animation-duration: 0.3s;
animation-timing-function: linear;
animation-iteration-count: 1;
}
@keyframes hvr-pop {
50% { transform: scale(1.2); }
}
HTML:
<a href="#" class="hvr-bounce-in">Bounce in</a>
CSS:
.hvr-bounce-in {
background: #289DCC;
transform: perspective(1px) translateZ(0);
transition-duration: 0.5s;
}
.hvr-bounce-in:focus,
.hvr-bounce-in:hover,
.hvr-bounce-in:active {
transform: scale(1.2);
transition-timing-function: cubic-bezier(0.47, 2.02, 0.31, -0.36);
}
HTML:
<a href="#" class="hvr-bounce-out">Bounce Out</a>
CSS:
.hvr-bounce-out {
background: #289DCC;
transform: perspective(1px) translateZ(0);
transition-duration: 0.5s;
}
.hvr-bounce-out:focus,
.hvr-bounce-out:hover,
.hvr-bounce-out:active {
transform: scale(0.8);
transition-timing-function: cubic-bezier(0.47, 2.02, 0.31, -0.36);
}
HTML:
<a href="#" class="hvr-rotate">Rotate</a>
CSS:
.hvr-rotate {
background: #289DCC;
transform: perspective(1px) translateZ(0);
transition-duration: 0.3s;
transition-property: transform;
}
.hvr-rotate:focus,
.hvr-rotate:hover,
.hvr-rotate:active {
transform: rotate(4deg);
}
HTML:
<a href="#" class="hvr-grow-rotate">Grow Rotate</a>
CSS:
.hvr-grow-rotate {
background: #289DCC;
transform: perspective(1px) translateZ(0);
transition-duration: 0.3s;
transition-property: transform;
}
.hvr-grow-rotate:focus,
.hvr-grow-rotate:hover,
.hvr-grow-rotate:active {
transform: scale(1.1) rotate(4deg);
}
HTML:
<a href="#" class="hvr-float">Float</a>
CSS:
.hvr-float {
background: #289DCC;
transform: perspective(1px) translateZ(0);
transition-duration: 0.3s;
transition-property: transform;
transition-timing-function: ease-out;
}
.hvr-float:focus,
.hvr-float:hover,
.hvr-float:active {
transform: translateY(-8px);
}
HTML:
<a href="#" class="hvr-sink">Sink</a>
CSS:
.hvr-sink {
background: #289DCC;
transform: perspective(1px) translateZ(0);
transition-duration: 0.3s;
transition-property: transform;
transition-timing-function: ease-out;
}
.hvr-sink:focus,
.hvr-sink:hover,
.hvr-sink:active {
transform: translateY(8px);
}
HTML:
<a href="#" class="hvr-bob">Bob</a>
CSS:
.hvr-bob {
background: #289DCC;
transform: perspective(1px) translateZ(0);
}
.hvr-bob:focus,
.hvr-bob:hover,
.hvr-bob:active {
animation-name: hvr-bob-float, hvr-bob;
animation-duration: .3s, 1.5s;
animation-delay: 0s, .3s;
animation-timing-function: ease-out, ease-in-out;
animation-iteration-count: 1, infinite;
animation-fill-mode: forwards;
animation-direction: normal, alternate;
}
@keyframes hvr-bob {
0% { transform: translateY(-8px); }
50% { transform: translateY(-4px); }
100% { transform: translateY(-8px); }
}
@keyframes hvr-bob-float {
100% { transform: translateY(-8px); }
}
HTML:
<a href="#" class="hvr-hang">Hang</a>
CSS:
.hvr-hang {
background: #289DCC;
transform: perspective(1px) translateZ(0);
}
.hvr-hang:focus,
.hvr-hang:hover,
.hvr-hang:active {
animation-name: hvr-hang-sink, hvr-hang;
animation-duration: .3s, 1.5s;
animation-delay: 0s, .3s;
animation-timing-function: ease-out, ease-in-out;
animation-iteration-count: 1, infinite;
animation-fill-mode: forwards;
animation-direction: normal, alternate;
}
@keyframes hvr-hang {
0% { transform:. translateY(8px); }
50% { transform: translateY(4px); }
100% { transform: translateY(8px);}
}
@keyframes hvr-hang-sink {
100% { transform: translateY(8px); }
}
HTML:
<a href="#" class="hvr-skew">Skew</a>
CSS:
.hvr-skew {
background: #289DCC;
transform: perspective(1px) translateZ(0);
transition-duration: 0.3s;
transition-property: transform;
}
.hvr-skew:focus,
.hvr-skew:hover,
.hvr-skew:active {
transform: skew(-10deg);
}
HTML:
<a href="#" class="hvr-skew-forward">Skew Forward</a>
CSS:
.hvr-skew-forward {
background: #289DCC;
transform: perspective(1px) translateZ(0);
transition-duration: 0.3s;
transition-property: transform;
transform-origin: 0 100%;
}
.hvr-skew-forward:focus,
.hvr-skew-forward:hover,
.hvr-skew-forward:active {
transform: skew(-10deg);
}
HTML:
<a href="#" class="hvr-skew-backward">Skew Backward</a>
CSS:
.hvr-skew-backward {
background: #289DCC;
transform: perspective(1px) translateZ(0);
transition-duration: 0.3s;
transition-property: transform;
transform-origin: 0 100%;
}
.hvr-skew-backward:focus,
.hvr-skew-backward:hover,
.hvr-skew-backward:active {
transform: skew(10deg);
}
HTML:
<a href="#" class="hvr-wobble-horizontal">Wobble Horizontal</a>
CSS:
.hvr-wobble-horizontal {
background: #289DCC;
transform: perspective(1px) translateZ(0);
}
.hvr-wobble-horizontal:focus,
.hvr-wobble-horizontal:hover,
.hvr-wobble-horizontal:active {
animation-name: hvr-wobble-horizontal;
animation-duration: 1s;
animation-timing-function: ease-in-out;
animation-iteration-count: 1;
}
@keyframes hvr-wobble-horizontal {
16.65% { transform: translateX(8px); }
33.3% { transform: translateX(-6px); }
49.95% { transform: translateX(4px); }
66.6% { transform: translateX(-2px); }
83.25% { transform: translateX(1px); }
100% { transform: translateX(0); }
}
HTML:
<a href="#" class="hvr-wobble-vertical">Wobble Vertical</a>
CSS:
.hvr-wobble-vertical {
background: #289DCC;
transform: perspective(1px) translateZ(0);
}
.hvr-wobble-vertical:focus,
.hvr-wobble-vertical:hover,
.hvr-wobble-vertical:active {
animation-name: hvr-wobble-vertical;
animation-duration: 1s;
animation-timing-function: ease-in-out;
animation-iteration-count: 1;
}
@keyframes hvr-wobble-vertical {
16.65% { transform: translateY(8px); }
33.3% { transform: translateY(-6px); }
49.95% { transform: translateY(4px); }
66.6% { transform: translateY(-2px); }
83.25% { transform: translateY(1px); }
100% { transform: translateY(0); }
}
HTML:
<a href="#" class="hvr-wobble-to-bottom-right">Wobble To Bottom Right</a>
CSS:
.hvr-wobble-to-bottom-right {
background: #289DCC;
transform: perspective(1px) translateZ(0);
}
.hvr-wobble-to-bottom-right:focus,
.hvr-wobble-to-bottom-right:hover,
.hvr-wobble-to-bottom-right:active {
animation-name: hvr-wobble-to-bottom-right;
animation-duration: 1s;
animation-timing-function: ease-in-out;
animation-iteration-count: 1;
}
@keyframes hvr-wobble-to-bottom-right {
16.65% { transform: translate(8px, 8px); }
33.3% { transform: translate(-6px, -6px); }
49.95% { transform: translate(4px, 4px); }
66.6% { transform: translate(-2px, -2px); }
83.25% { transform: translate(1px, 1px); }
100% { transform: translate(0, 0); }
}
HTML:
<a href="#" class="hvr-wobble-to-top-right">Wobble To Top Right</a>
CSS:
.hvr-wobble-to-top-right {
background: #289DCC;
transform: perspective(1px) translateZ(0);
}
.hvr-wobble-to-top-right:focus,
.hvr-wobble-to-top-right:hover,
.hvr-wobble-to-top-right:active {
animation-name: hvr-wobble-to-top-right;
animation-duration: 1s;
animation-timing-function: ease-in-out;
animation-iteration-count: 1;
}
@keyframes hvr-wobble-to-top-right {
16.65% { transform: translate(8px, -8px); }
33.3% { transform: translate(-6px, 6px); }
49.95% { transform: translate(4px, -4px); }
66.6% { transform: translate(-2px, 2px); }
83.25% { transform: translate(1px, -1px); }
100% { transform: translate(0, 0); }
}
HTML:
<a href="#" class="hvr-wobble-top">Wobble Top</a>
CSS:
.hvr-wobble-top {
background: #289DCC;
transform: perspective(1px) translateZ(0);
transform-origin: 0 100%;
}
.hvr-wobble-top:focus,
.hvr-wobble-top:hover,
.hvr-wobble-top:active {
animation-name: hvr-wobble-top;
animation-duration: 1s;
animation-timing-function: ease-in-out;
animation-iteration-count: 1;
}
@keyframes hvr-wobble-top {
16.65% { transform: skew(-12deg); }
33.3% { transform: skew(10deg); }
49.95% { transform: skew(-6deg); }
66.6% { transform: skew(4deg); }
83.25% { transform: skew(-2deg); }
100% { transform: skew(0); }
}
HTML:
<a href="#" class="hvr-wobble-bottom">Wobble Bottom</a>
CSS:
.hvr-wobble-bottom {
background: #289DCC;
transform: perspective(1px) translateZ(0);
transform-origin: 100% 0;
}
.hvr-wobble-bottom:focus,
.hvr-wobble-bottom:hover,
.hvr-wobble-bottom:active {
animation-name: hvr-wobble-bottom;
animation-duration: 1s;
animation-timing-function: ease-in-out;
animation-iteration-count: 1;
}
@keyframes hvr-wobble-bottom {
16.65% { transform: skew(-12deg); }
33.3% { transform: skew(10deg); }
49.95% { transform: skew(-6deg); }
66.6% { transform: skew(4deg); }
83.25% { transform: skew(-2deg); }
100% { transform: skew(0); }
}
HTML:
<a href="#" class="hvr-wobble-skew">Wobble Skew</a>
CSS:
.hvr-wobble-skew {
background: #289DCC;
transform: perspective(1px) translateZ(0);
}
.hvr-wobble-skew:focus,
.hvr-wobble-skew:hover,
.hvr-wobble-skew:active {
animation-name: hvr-wobble-skew;
animation-duration: 1s;
animation-timing-function: ease-in-out;
animation-iteration-count: 1;
}
@keyframes hvr-wobble-skew {
16.65% { transform: skew(-12deg); }
33.3% { transform: skew(10deg); }
49.95% { transform: skew(-6deg); }
66.6% { transform: skew(4deg); }
83.25% { transform: skew(-2deg); }
100% { transform: skew(0); }
}
HTML:
<a href="#" class="hvr-buzz">Buzz</a>
CSS:
.hvr-buzz {
background: #289DCC;
transform: perspective(1px) translateZ(0);
}
.hvr-buzz:focus,
.hvr-buzz:hover,
.hvr-buzz:active {
animation-name: hvr-buzz;
animation-duration: 0.15s;
animation-timing-function: linear;
animation-iteration-count: infinite;
}
@keyframes hvr-buzz {
50% { transform: translateX(3px) rotate(2deg); }
100% { transform: translateX(-3px) rotate(-2deg); }
}
HTML:
<a href="#" class="hvr-buzz-out">Buzz Out</a>
CSS:
.hvr-buzz-out {
background: #289DCC;
transform: perspective(1px) translateZ(0);
}
.hvr-buzz-out:focus,
.hvr-buzz-out:hover,
.hvr-buzz-out:active {
animation-name: hvr-buzz-out;
animation-duration: 0.75s;
animation-timing-function: linear;
animation-iteration-count: 1;
}
@keyframes hvr-buzz-out {
10% { transform: translateX(3px) rotate(2deg); }
20% { transform: translateX(-3px) rotate(-2deg); }
30% { transform: translateX(3px) rotate(2deg); }
40% { transform: translateX(-3px) rotate(-2deg); }
50% { transform: translateX(2px) rotate(1deg); }
60% { transform: translateX(-2px) rotate(-1deg); }
70% { transform: translateX(2px) rotate(1deg); }
80% { transform: translateX(-2px) rotate(-1deg); }
90% { transform: translateX(1px) rotate(0); }
100% { transform: translateX(-1px) rotate(0); }
}
HTML:
<a href="#" class="hvr-forward">Forward</a>
CSS:
.hvr-forward {
background: #289DCC;
transform: perspective(1px) translateZ(0);
transition-duration: 0.3s;
transition-property: transform;
}
.hvr-forward:focus,
.hvr-forward:hover,
.hvr-forward:active {
transform: translateX(8px);
}
HTML:
<a href="#" class="hvr-backward">Backward</a>
CSS:
.hvr-backward {
background: #289DCC;
transform: perspective(1px) translateZ(0);
transition-duration: 0.3s;
transition-property: transform;
}
.hvr-backward:focus,
.hvr-backward:hover,
.hvr-backward:active {
transform: translateX(-8px);
}
Background Transitions
HTML:
<a href="#" class="hvr-fade">Fade</a>
CSS:
.hvr-fade {
background: white;
transition-duration: 0.3s;
transition-property: color, background;
}
.hvr-fade:focus,
.hvr-fade:hover,
.hvr-fade:active {
background: #289DCC;
}
HTML:
<a href="#" class="hvr-back-pulse">Pulse</a>
CSS:
.hvr-back-pulse {
background: white;
transition-duration: 0.5s;
transition-property: color, background;
}
.hvr-back-pulse:focus,
.hvr-back-pulse:hover,
.hvr-back-pulse:active {
background: #289DCC;
animation-name: hvr-back-pulse;
animation-duration: 1s;
animation-delay: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
}
@keyframes hvr-back-pulse {
50% { background: rgba(40, 157, 204, 0.75); }
}
HTML:
<a href="#" class="hvr-sweep-to-right">Sweep To Right</a>
CSS:
.hvr-sweep-to-right {
background: white;
position: relative;
transform: perspective(1px) translateZ(0);
transition-property: color;
transition-duration: 0.3s;
}
.hvr-sweep-to-right:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #289DCC;
transform: scaleX(0);
transform-origin: 0 50%;
transition-property: transform;
transition-duration: 0.3s;
transition-timing-function: ease-out;
}
.hvr-sweep-to-right:focus:before,
.hvr-sweep-to-right:hover:before,
.hvr-sweep-to-right:active:before {
transform: scaleX(1);
}
HTML:
<a href="#" class="hvr-sweep-to-left">Sweep To Left</a>
CSS:
.hvr-sweep-to-left {
background: white;
position: relative;
transform: perspective(1px) translateZ(0);
transition-property: color;
transition-duration: 0.3s;
}
.hvr-sweep-to-left:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #289DCC;
transform: scaleX(0);
transform-origin: 100% 50%;
transition-property: transform;
transition-duration: 0.3s;
transition-timing-function: ease-out;
}
.hvr-sweep-to-left:focus:before,
.hvr-sweep-to-left:hover:before,
.hvr-sweep-to-left:active:before {
transform: scaleX(1);
}
HTML:
<a href="#" class="hvr-sweep-to-bottom">Sweep To Bottom</a>
CSS:
.hvr-sweep-to-bottom {
background: white;
position: relative;
transform: perspective(1px) translateZ(0);
transition-property: color;
transition-duration: 0.3s;
}
.hvr-sweep-to-bottom:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #289DCC;
transform: scaleY(0);
transform-origin: 50% 0;
transition-property: transform;
transition-duration: 0.3s;
transition-timing-function: ease-out;
}
.hvr-sweep-to-bottom:focus:before,
.hvr-sweep-to-bottom:hover:before,
.hvr-sweep-to-bottom:active:before {
transform: scaleY(1);
}
HTML:
<a href="#" class="hvr-sweep-to-top">Sweep To Top</a>
CSS:
.hvr-sweep-to-top {
background: white;
position: relative;
transform: perspective(1px) translateZ(0);
transition-property: color;
transition-duration: 0.3s;
}
.hvr-sweep-to-top:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #289DCC;
transform: scaleY(0);
transform-origin: 50% 100%;
transition-property: transform;
transition-duration: 0.3s;
transition-timing-function: ease-out;
}
.hvr-sweep-to-top:focus:before,
.hvr-sweep-to-top:hover:before,
.hvr-sweep-to-top:active:before {
transform: scaleY(1);
}
HTML:
<a href="#" class="hvr-bounce-to-right">Bounce To Right</a>
CSS:
.hvr-bounce-to-right {
background: white;
position: relative;
transform: perspective(1px) translateZ(0);
transition-property: color;
transition-duration: 0.5s;
}
.hvr-bounce-to-right:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #289DCC;
transform: scaleX(0);
transform-origin: 0 50%;
transition-property: transform;
transition-duration: 0.5s;
transition-timing-function: ease-out;
}
.hvr-bounce-to-right:focus:before,
.hvr-bounce-to-right:hover:before,
.hvr-bounce-to-right:active:before {
transform: scaleX(1);
transition-timing-function: cubic-bezier(0.52, 1.64, 0.37, 0.66);
}
HTML:
<a href="#" class="hvr-bounce-to-left">Bounce To Left</a>
CSS:
.hvr-bounce-to-left {
background: white;
position: relative;
transform: perspective(1px) translateZ(0);
transition-property: color;
transition-duration: 0.5s;
}
.hvr-bounce-to-left:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #289DCC;
transform: scaleX(0);
transform-origin: 100% 50%;
transition-property: transform;
transition-duration: 0.5s;
transition-timing-function: ease-out;
}
.hvr-bounce-to-left:focus:before,
.hvr-bounce-to-left:hover:before,
.hvr-bounce-to-left:active:before {
transform: scaleX(1);
transition-timing-function: cubic-bezier(0.52, 1.64, 0.37, 0.66);
}
HTML:
<a href="#" class="hvr-bounce-to-bottom">Bounce To Bottom</a>
CSS:
.hvr-bounce-to-bottom {
background: white;
position: relative;
transform: perspective(1px) translateZ(0);
transition-property: color;
transition-duration: 0.5s;
}
.hvr-bounce-to-bottom:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #289DCC;
transform: scaleY(0);
transform-origin: 50% 0;
transition-property: transform;
transition-duration: 0.5s;
transition-timing-function: ease-out;
}
.hvr-bounce-to-bottom:focus:before,
.hvr-bounce-to-bottom:hover:before,
.hvr-bounce-to-bottom:active:before {
transform: scaleY(1);
transition-timing-function: cubic-bezier(0.52, 1.64, 0.37, 0.66);
}
HTML:
<a href="#" class="hvr-bounce-to-top">Bounce To Top</a>
CSS:
.hvr-bounce-to-top {
background: white;
position: relative;
transform: perspective(1px) translateZ(0);
transition-property: color;
transition-duration: 0.5s;
}
.hvr-bounce-to-top:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #289DCC;
transform: scaleY(0);
transform-origin: 50% 100%;
transition-property: transform;
transition-duration: 0.5s;
transition-timing-function: ease-out;
}
.hvr-bounce-to-top:focus:before,
.hvr-bounce-to-top:hover:before,
.hvr-bounce-to-top:active:before {
transform: scaleY(1);
transition-timing-function: cubic-bezier(0.52, 1.64, 0.37, 0.66);
}
HTML:
<a href="#" class="hvr-radial-out">Radial Out</a>
CSS:
.hvr-radial-out {
background: white;
position: relative;
overflow: hidden;
transform: perspective(1px) translateZ(0);
transition-property: color;
transition-duration: 0.3s;
}
.hvr-radial-out:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #289DCC;
border-radius: 100%;
transform: scale(0);
transition-property: transform;
transition-duration: 0.3s;
transition-timing-function: ease-out;
}
.hvr-radial-out:focus:before,
.hvr-radial-out:hover:before,
.hvr-radial-out:active:before {
transform: scale(2);
}
HTML:
<a href="#" class="hvr-radial-in">Radial In</a>
CSS:
.hvr-radial-in {
position: relative;
overflow: hidden;
transform: perspective(1px) translateZ(0);
transition-property: color;
transition-duration: 0.3s;
}
.hvr-radial-in:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: white;
border-radius: 100%;
transform: scale(2);
transition-property: transform;
transition-duration: 0.3s;
transition-timing-function: ease-out;
}
.hvr-radial-in:focus,
.hvr-radial-in:hover,
.hvr-radial-in:active {
background: #289DCC;
}
.hvr-radial-in:focus:before,
.hvr-radial-in:hover:before,
.hvr-radial-in:active:before {
transform: scale(0);
}
HTML:
<a href="#" class="hvr-rectangle-in">Rectangle In</a>
CSS:
.hvr-rectangle-in {
position: relative;
background: #289DCC;
transform: perspective(1px) translateZ(0);
transition-property: color;
transition-duration: 0.3s;
}
.hvr-rectangle-in:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: white;
transform: scale(1);
transition-property: transform;
transition-duration: 0.3s;
transition-timing-function: ease-out;
}
.hvr-rectangle-in:focus,
.hvr-rectangle-in:hover,
.hvr-rectangle-in:active {
background: #289DCC;
}
.hvr-rectangle-in:focus:before,
.hvr-rectangle-in:hover:before,
.hvr-rectangle-in:active:before {
transform: scale(0);
}
HTML:
<a href="#" class="hvr-rectangle-out">Rectangle Out</a>
CSS:
.hvr-rectangle-out {
position: relative;
background: white;
transform: perspective(1px) translateZ(0);
transition-property: color;
transition-duration: 0.3s;
}
.hvr-rectangle-out:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #289DCC;
transform: scale(0);
transition-property: transform;
transition-duration: 0.3s;
transition-timing-function: ease-out;
}
.hvr-rectangle-out:focus:before,
.hvr-rectangle-out:hover:before,
.hvr-rectangle-out:active:before {
transform: scale(1);
}
HTML:
<a href="#" class="hvr-shutter-in-horizontal">Shutter In Horizontal</a>
CSS:
.hvr-shutter-in-horizontal {
position: relative;
background: #289DCC;
transform: perspective(1px) translateZ(0);
transition-property: color;
transition-duration: 0.3s;
}
.hvr-shutter-in-horizontal:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: white;
transform: scaleX(1);
transform-origin: 50%;
transition-property: transform;
transition-duration: 0.3s;
transition-timing-function: ease-out;
}
.hvr-shutter-in-horizontal:focus,
.hvr-shutter-in-horizontal:hover,
.hvr-shutter-in-horizontal:active {
background: #289DCC;
}
.hvr-shutter-in-horizontal:focus:before,
.hvr-shutter-in-horizontal:hover:before,
.hvr-shutter-in-horizontal:active:before {
transform: scaleX(0);
}
HTML:
<a href="#" class="hvr-shutter-out-horizontal">Shutter Out Horizontal</a>
CSS:
.hvr-shutter-out-horizontal {
position: relative;
background: white;
transform: perspective(1px) translateZ(0);
transition-property: color;
transition-duration: 0.3s;
}
.hvr-shutter-out-horizontal:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: #289DCC;
transform: scaleX(0);
transform-origin: 50%;
transition-property: transform;
transition-duration: 0.3s;
transition-timing-function: ease-out;
}
.hvr-shutter-out-horizontal:focus:before,
.hvr-shutter-out-horizontal:hover:before,
.hvr-shutter-out-horizontal:active:before {
transform: scaleX(1);
}
HTML:
<a href="#" class="hvr-shutter-in-vertical">Shutter In Vertical</a>
CSS:
.hvr-shutter-in-vertical {
position: relative;
background: #289DCC;
transform: perspective(1px) translateZ(0);
transition-property: color;
transition-duration: 0.3s;
}
.hvr-shutter-in-vertical:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: white;
transform: scaleY(1);
transform-origin: 50%;
transition-property: transform;
transition-duration: 0.3s;
transition-timing-function: ease-out;
}
.hvr-shutter-in-vertical:focus,
.hvr-shutter-in-vertical:hover,
.hvr-shutter-in-vertical:active {
background: #289DCC;
}
.hvr-shutter-in-vertical:hover:before,
.hvr-shutter-in-vertical:focus:before,
.hvr-shutter-in-vertical:active:before {
transform: scaleY(0);
}
HTML:
<a href="#" class="hvr-shutter-out-vertical">Shutter Out Vertical</a>
CSS:
.hvr-shutter-out-vertical {
position: relative;
background: white;
transform: perspective(1px) translateZ(0);
transition-property: color;
transition-duration: 0.3s;
}
.hvr-shutter-out-vertical:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: #289DCC;
transform: scaleY(0);
transform-origin: 50%;
transition-property: transform;
transition-duration: 0.3s;
transition-timing-function: ease-out;
}
.hvr-shutter-out-vertical:focus:before,
.hvr-shutter-out-vertical:hover:before,
.hvr-shutter-out-vertical:active:before {
transform: scaleY(1);
}
Na podstawie tympanus.net
wspólne własności
HTML <div class="holdButtons"> <button class="btn btn-1 btn-1a">Button btn-1a</button> <button class="btn btn-1 btn-1b">Button btn-1b</button> <button class="btn btn-1 btn-1c">Button btn-1c</button> <button class="btn btn-1 btn-1d">Button btn-1d</button> <button class="btn btn-1 btn-1e">Button btn-1e</button> <button class="btn btn-1 btn-1f">Button btn-1f</button> </div>
CSS .holdButtons { position: relative; z-index: 1; display: grid; grid-template-columns: auto auto auto; grid-row: auto auto; grid-gap: 40px; } .btn { background: none; border: none; outline: none; letter-spacing: 1px; text-transform: uppercase; cursor: pointer; padding-top: 20px; padding-bottom: 20px; position: relative; transition: all 0.3s; } .btn:after { content: ''; position: absolute; z-index: -1; transition: all 0.3s; } /* Button 1 */ .btn-1 { border: 3px solid #289DCC; color: #fff; }
KLIKNIJ na poszczególne buttony, aby zobaczyć pozostałe zapisy css.
/* Button 1a */ .btn-1a:hover, .btn-1a:active { color: #232323; background: #fff; }
/* Button 1b */ .btn-1b:after { width: 100%; height: 0; top: 0; left: 0; background: #fff; } .btn-1b:hover, .btn-1b:active { color: #232323; } .btn-1b:hover:after, .btn-1b:active:after { height: 100%; }
/* Button 1c */ .btn-1c:after { width: 0%; height: 100%; top: 0; left: 0; background: #fff; } .btn-1c:hover, .btn-1c:active { color: #232323; } .btn-1c:hover:after, .btn-1c:active:after { width: 100%; }
/* Button 1d */ .btn-1d { overflow: hidden; } .btn-1d:after { width: 0; height: 103%; top: 50%; left: 50%; background: #fff; opacity: 0; transform: translateX(-50%) translateY(-50%); } .btn-1d:hover, .btn-1d:active { color: #232323; } .btn-1d:hover:after { width: 90%; opacity: 1; } .btn-1d:active:after { width: 101%; opacity: 1; }
/* Button 1e */ .btn-1e { overflow: hidden; } .btn-1e:after { width: 100%; height: 0; top: 50%; left: 50%; background: #fff; opacity: 0; transform: translateX(-50%) translateY(-50%) rotate(45deg); } .btn-1e:hover, .btn-1e:active { color: #232323; } .btn-1e:hover:after { height: 260%; opacity: 1; } .btn-1e:active:after { height: 400%; opacity: 1; }
/* Button 1f */ .btn-1f { overflow: hidden; } .btn-1f:after { width: 101%; height: 0; top: 50%; left: 50%; background: #fff; opacity: 0; transform: translateX(-50%) translateY(-50%); } .btn-1f:hover, .btn-1f:active { color: #232323; } .btn-1f:hover:after { height: 75%; opacity: 1; } .btn-1f:active:after { height: 130%; opacity: 1; }
Na podstawie codepen.io
<button class="glow-on-hover">HOVER ME, THEN CLICK ME!</button> .glow-on-hover { background: #111; border: none; outline: none; border-radius: 10px; display: block; padding: 20px 50px; color: #fff; cursor: pointer; position: relative; z-index: 0; line-height: 150%; } .glow-on-hover:before { content: ''; background: linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000); background-size: 400%; border-radius: 10px; position: absolute; top: -2px; left: -2px; z-index: -1; filter: blur(5px); width: calc(100% + 4px); height: calc(100% + 4px); animation: glowing 20s linear infinite; opacity: 0; transition: opacity .3s ease-in-out; }
.glow-on-hover:active { color: #000 } .glow-on-hover:active:after { background: transparent; } .glow-on-hover:hover:before { opacity: 1; } .glow-on-hover:after { content: ''; background: #111; border-radius: 10px; position: absolute; top: 0; left: 0; z-index: -1; width: 100%; height: 100%; } @keyframes glowing { 0% { background-position: 0 0; } 50% { background-position: 400% 0; } 100% { background-position: 0 0; } }
na podstawie ddle.net
<button class="ddle">CLICK ME!</button> .ddle { background: #289FCC; position: relative; overflow: hidden; margin: 0 auto; padding: 35px 35px; display: block; border-radius: 5px; color: #fff; text-decoration: none; text-align: center; line-height: 150%; } .ddle:after { content: ""; position: absolute; top: -110%; left: -210%; width: 200%; height: 200%; opacity: 0; transform: rotate(30deg); background: rgba(255, 255, 255, 0.13); background: linear-gradient(to right, rgba(255, 255, 255, 0.13) 0%, rgba(255, 255, 255, 0.13) 77%, rgba(255, 255, 255, 0.5) 92%, rgba(255, 255, 255, 0.0) 100%); transition: all 0.7s; } .ddle:hover:after { opacity: 1; top: -30%; left: -30%; transition-property: left, top, opacity; transition-duration: 0.7s, 0.7s, 0.15s; transition-timing-function: ease; } .ddle:active:after { opacity: 0; }
na podstawie learn.shayhowe.com
<button class="learn">CLICK ME!</button> .learn { background: #111; border: 0; box-shadow: 0 5px 0 #616161; margin: 0 auto; padding: 20px 50px; display: block; transition: all .1s linear; } .learn:hover, .learn:active { box-shadow: 0 2px 0 #616161; transform: translateY(3px); }