Вариант 1:
Большая кнопка, которая хорошо подойдет для закрытия полноэкранных модальных окон.
1 2 3 4 5 6 7 8 9 10 11 12 |
<div class="cl-btn-1"> <div> <span class="left"> <span class="circle-left"></span> <span class="circle-right"></span> </span> <span class="right"> <span class="circle-left"></span> <span class="circle-right"></span> </span> </div> </div> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
.cl-btn-1 { margin: 20px; position: relative; display: flex; justify-content: center; height: 112px; } .cl-btn-1 div { width: 100px; height: 100px; position: absolute; background-image: radial-gradient(#FFF, #BFE2FF); border-radius: 50%; transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1); border: 6px solid #337AB7; cursor: pointer; } .cl-btn-1 div > span { background-color: #337AB7; display: block; height: 12px; border-radius: 6px; position: relative; transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1); position: absolute; top: 50%; margin-top: -6px; left: 18px; width: 64px; } .cl-btn-1 div > span span { display: block; background-color: #215b8c; width: 12px; height: 12px; border-radius: 6px; transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1); position: absolute; left: 0; top: 0; } .cl-btn-1 div > span.left { transform: rotate(45deg); transform-origin: center; } .cl-btn-1 div > span.left .circle-left { transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1); margin-left: 0; } .cl-btn-1 div > span.left .circle-right { transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1); margin-left: 52px; } .cl-btn-1 div > span.right { transform: rotate(-45deg); transform-origin: center; } .cl-btn-1 div > span.right .circle-left { transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1); margin-left: 0; } .cl-btn-1 div > span.right .circle-right { transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1); margin-left: 52px; } .cl-btn-1 div:hover > span { background-color: #215b8c; transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1); } .cl-btn-1 div:hover > span span { transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1); background-color: #337AB7; } .cl-btn-1 div:hover > span.left .circle-left { transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1); margin-left: 52px; } .cl-btn-1 div:hover > span.left .circle-right { transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1); margin-left: 0; } .cl-btn-1 div:hover > span.right .circle-left { transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1); margin-left: 52px; } .cl-btn-1 div:hover > span.right .circle-right { transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1); margin-left: 0; } |
Вариант 2:
Кнопка с подписью "закрыть" при наведении.
закрыть
1 2 3 4 5 6 7 |
<div class="cl-btn-2"> <div> <div class="leftright"></div> <div class="rightleft"></div> <span class="close-btn">закрыть</span> </div> </div> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
.cl-btn-2 { margin: 20px; display: flex; justify-content: center; } .cl-btn-2 div { cursor: pointer; position: relative; height: 68px; width: 50px; } .cl-btn-2 .leftright { height: 4px; width: 50px; position: absolute; margin-top: 24px; background-color: #337AB7; border-radius: 2px; transform: rotate(45deg); transition: all .3s ease-in; } .cl-btn-2 .rightleft { height: 4px; width: 50px; position: absolute; margin-top: 24px; background-color: #337AB7; border-radius: 2px; transform: rotate(-45deg); transition: all .3s ease-in; } .cl-btn-2 .close-btn { margin: 54px 0 0 -5px; position: absolute; color: #337AB7; font-family: Tahoma, sans-serif; font-size: 13px; font-weight: bold; text-transform: uppercase; transition: all .3s ease-in; opacity: 0; } .cl-btn-2 div:hover .leftright { transform: rotate(-45deg); background-color: #000; } .cl-btn-2 div:hover .rightleft { transform: rotate(45deg); background-color: #000; } .cl-btn-2 div:hover .close-btn { opacity: 1; } |
Вариант 3:
Кнопка аналогичная предыдущей, но с другим ховер-эффектом
1 2 3 4 |
<div class="cl-btn-3"> <span class="top"></span> <span class="bot"></span> </div> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
.cl-btn-3 { width: 26px; height: 26px; margin: 40px auto; position: relative; transform: rotate(45deg) scale(2); } .cl-btn-3 .top, .cl-btn-3 .bot { display: block; background: #337AB7; position: absolute; top: 50%; left: 50%; animation-timing-function: cubic-bezier(1, 0, 0, 1); animation-iteration-count: 1; } .cl-btn-3 .top { height: 100%; width: 2px; margin-left: -1px; transform: skewY(45deg); top: 0; } .cl-btn-3 .bot { width: 100%; height: 2px; margin-top: -1px; transform: skewX(-45deg); left: 0; } @-webkit-keyframes top-out { from { top: 0%; height: 100%; } to { top: 200%; height: 0%; } } @keyframes top-out { from { top: 0%; height: 100%; } to { top: 200%; height: 0%; } } @-webkit-keyframes top-in { from { top: -100%; height: 0%; } to { top: 0%; height: 100%; } } @keyframes top-in { from { top: -100%; height: 0%; } to { top: 0%; height: 100%; } } @-webkit-keyframes bot-out { from { left: 0%; width: 100%; } to { left: 200%; width: 0%; } } @keyframes bot-out { from { left: 0%; width: 100%; } to { left: 200%; width: 0%; } } @-webkit-keyframes bot-in { from { left: -100%; width: 0%; } to { left: 0%; width: 100%; } } @keyframes bot-in { from { left: -100%; width: 0%; } to { left: 0%; width: 100%; } } .cl-btn-3:hover { cursor: pointer; } .cl-btn-3:hover .top { animation: top-out 0.25s forwards, top-in 0.25s forwards 0.25s; } .cl-btn-3:hover .bot { animation: bot-out 0.25s forwards 0.1s, bot-in 0.25s forwards 0.35s; } |
Вариант 4:
Складывающая в линию кнопка
1 |
<div class="cl-btn-4"></div> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
.cl-btn-4 { width: 120px; height: 120px; box-shadow: 0px 10 10px 10px rgba(0, 0, 0, 0.25); border-radius: 6px; background: #337AB7; margin: 20px auto; position: relative; display: block; z-index: 200; text-indent: -9999px; cursor: pointer; } .cl-btn-4:before, .cl-btn-4:after { content: ''; width: 80%; height: 6px; background: #BFE2FF; position: absolute; top: 48%; left: 10%; transform: rotate(45deg); transition: all 0.3s ease-out; } .cl-btn-4:after { transform: rotate(-45deg); transition: all 0.3s ease-out; } .cl-btn-4:hover:before, .cl-btn-4:hover:after { transform: rotate(180deg); background: #FFF; } |
Вариант 5:
3D кнопка с ховер-эффектом
1 2 3 4 5 6 |
<span class='cl-btn-5'> <span> <span> </span> </span> </span> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
.cl-btn-5 { display: block; margin: 20px auto 40px auto; perspective: 300px; width: 75px; } .cl-btn-5 * { box-sizing: border-box; } .cl-btn-5 > span { background: #BFE2FF; border: none; box-shadow: 1px 43px 41px -22px rgba(0, 0, 0, 0.7); cursor: pointer; display: block; transform-style: preserve-3d; transition: all 250ms ease-in; transform: rotateX(30deg); outline: 1px solid transparent; padding: 18px; position: relative; width: 100%; } .cl-btn-5 > span:after { background: #BFE2FF; content: ""; height: 40%; left: 0; position: absolute; top: 100%; transform-origin: 0% 0%; transform: rotateX(-90deg); transition: all 250ms ease-in; width: 100%; z-index: -1; } .cl-btn-5 > span > span { display: block; height: 40px; position: relative; transform: scale(0.9); width: 40px; } .cl-btn-5 > span > span:before, .cl-btn-5 > span > span:after { content: ""; border-radius: 2px; display: block; width: 85%; height: 25%; position: absolute; top: 37%; left: 8%; transition: 0.3s; background: #337AB7; transform: rotate(-45deg); } .cl-btn-5 > span > span:after { transform: rotate(45deg); } .cl-btn-5 > span:hover, .cl-btn-5 > span:focus { background: #BFE2FF; box-shadow: 1px 43px 41px -22px black; color: #ED8728; transform: rotateX(10deg); } .cl-btn-5 > span:hover:after, .cl-btn-5 > span:focus:after { background: #BFE2FF; } .cl-btn-5 > span:hover > span:before, .cl-btn-5 > span:hover > span:after, .cl-btn-5 > span:focus > span:before, .cl-btn-5 > span:focus > span:after { width: 62%; } .cl-btn-5 > span:hover > span:before, .cl-btn-5 > span:focus > span:before { transform: rotate(180deg) translate(0, 0); } .cl-btn-5 > span:hover > span:after, .cl-btn-5 > span:focus > span:after { transform: rotate(-180deg) translate(-37.5%, 0); } .cl-btn-5 > span:active { transform: rotateX(20deg); } .cl-btn-5 > span:active > span:before, .cl-btn-5 > span:active > span:after { background: skyblue; } .cl-btn-5.active > span > span:before, .cl-btn-5.active > span > span:after { width: 62%; } .cl-btn-5.active > span > span:before { transform: rotate(180deg) translate(0, 0); } .cl-btn-5.active > span > span:after { transform: rotate(-180deg) translate(-37.5%, 0); } |
Вариант 6:
Еще один вариант кнопки с подписью "закрыть" при наведении.
Закрыть
1 2 3 4 5 |
<div class="cl-btn-6"> <div class="cl-btn-6-in"> <div class="cl-btn-6-txt">Закрыть</div> </div> </div> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
.cl-btn-6 { position: relative; margin: 20px auto; width: 70px; cursor: pointer; } .cl-btn-6-in { width: inherit; text-align: center; } .cl-btn-6-txt { font-size: 13px; line-height: 40px; font-weight: bold; text-transform: uppercase; color: #337AB7; transition: all .3s ease-in; opacity: 0; cursor: pointer; font-family: Verdana; } .cl-btn-6-in:before, .cl-btn-6-in:after { position: absolute; content: ''; height: 4px; width: inherit; background: #337AB7; left: 0; transition: all .3s ease-in; } .cl-btn-6-in:before { top: calc(50% - 4px); transform: rotate(45deg); } .cl-btn-6-in:after { bottom: 50%; transform: rotate(-45deg); } .cl-btn-6:hover .cl-btn-6-txt { opacity: 1; } .cl-btn-6:hover .cl-btn-6-in:before, .cl-btn-6:hover .cl-btn-6-in:after { transform: rotate(0); } .cl-btn-6:hover .cl-btn-6-in:before { top: 0; } .cl-btn-6:hover .cl-btn-6-in:after { bottom: 0; } |
Вариант 7:
Простенькая маленькая кнопка
1 |
<div class="cl-btn-7"></div> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
.cl-btn-7 { width: 40px; height: 40px; border-radius: 40px; position: relative; z-index: 1; margin: 20px auto; cursor: pointer; } .cl-btn-7:before { content: '+'; color: #337AB7; position: absolute; z-index: 2; transform: rotate(45deg); font-size: 50px; line-height: 1; top: -5px; left: 6px; transition: all 0.3s cubic-bezier(0.77, 0, 0.2, 0.85); } .cl-btn-7:after { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 100%; background: #337AB7; z-index: 1; transition: all 0.3s cubic-bezier(0.77, 0, 0.2, 0.85); transform: scale(0.01); } .cl-btn-7:hover:after { transform: scale(1); } .cl-btn-7:hover:before { transform: scale(0.8) rotate(45deg); color: #fff; } |
Вариант 8:
Кнопка открыть/закрыть с использованием библиотеки jQuery
1 2 3 |
<div class="cl-btn-8"> <div class="dot"></div> </div> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
.cl-btn-8 { position: relative; width: 45px; height: 45px; cursor: pointer; margin: 30px auto 20px auto; } .cl-btn-8 .dot { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 9px; height: 9px; background: #337AB7; border-radius: 50%; transition: all 0.35s ease; backface-visibility: hidden; } .cl-btn-8.hover .dot { background: transparent; } .cl-btn-8 .dot::before, .cl-btn-8 .dot::after { display: block; content: ''; position: absolute; bottom: 0; background: #337AB7; width: 9px; height: 9px; border-radius: 50%; transition: all 0.35s ease; } .cl-btn-8.hover .dot::before, .cl-btn-8.hover .dot::after { height: 45px; border-radius: 0; } .cl-btn-8 .dot::before { left: -18px; } .cl-btn-8.hover .dot::before { transform: rotate(45deg); transform-origin: right bottom; border-radius: 9px; } .cl-btn-8 .dot::after { right: -18px; } .cl-btn-8.hover .dot::after { transform: rotate(-45deg); transform-origin: left bottom; border-radius: 9px; } |
1 2 3 |
$('.cl-btn-8').click('on', function() { $(this).toggleClass('hover'); }); |
Вариант 9:
Еще одна кнопка открыть/закрыть с использованием библиотеки jQuery
Открыть
1 2 3 |
<div class="cl-btn-9"> <div class="cl-btn-9-txt">Открыть</div> </div> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
.cl-btn-9 { position: relative; margin: 50px auto; width: 100px; height: 100px; background:#337AB7; border-radius:50%; cursor:pointer; } .cl-btn-9:before { position:absolute; content:""; width:30px; height:4px; left: 24px; top: 64px; background:#BFE2FF; transform:rotate(45deg); transition:0.2s; } .cl-btn-9:after { position:absolute; content:""; width:30px; height:4px; right:25px; top:64px; background:#BFE2FF; transform:rotate(-45deg); transition:0.2s; } .cl-btn-9-txt { position:relative; text-align:center; padding-top:25px; color:#fff; font-family:Roboto; } .cl-btn-9-up:before { position:absolute; content:""; width:35px; height:4px; left:32px; top:66px; background:#fff; transform:rotate(45deg); transition:0.2s; } .cl-btn-9-up:after { position:absolute; content:""; width:35px; height:4px; right:33px; top:66px; background:#fff; transform:rotate(-45deg); transition:0.2s; } |
1 2 3 4 5 |
$(".cl-btn-9").click(function(){ var currenttext = $(".cl-btn-9-txt").html(); if(currenttext == "Открыть"){$(".cl-btn-9-txt").html("Закрыть");}else{$(".cl-btn-9-txt").html("Открыть");} $(this).toggleClass("cl-btn-9-up"); }); |
Добавить комментарий: