Last active
February 9, 2020 23:53
-
-
Save cleoold/75e99a22b9b1606475a4ed3602ab529c to your computer and use it in GitHub Desktop.
Two plain CSS buttons
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>Button</title> | |
| <link href="https://fonts.googleapis.com/css?family=Raleway:600&display=swap" rel="stylesheet"> | |
| </head> | |
| <style> | |
| body, html { | |
| width: 100%; | |
| margin: 0; | |
| font-size: 16px; | |
| } | |
| span, p, a, h1, h2, h3, h4, h5, h6, button, input { | |
| font-family: 'Raleway', sans-serif; | |
| color: white; | |
| } | |
| h1 { | |
| margin: 3rem 0; | |
| } | |
| a:visited { | |
| color: inherit; | |
| } | |
| #container1 { | |
| height: 50%; | |
| background: rgb(46, 113, 201); | |
| display: flex; | |
| flex-direction: column; | |
| align-items: center; | |
| justify-content: center; | |
| } | |
| .animated-button { | |
| display: inline-block; | |
| position: relative; | |
| box-sizing: border-box; | |
| border: none; | |
| padding: 0 16px; | |
| width: 120px; | |
| height: 40px; | |
| text-align: center; | |
| color: white; | |
| background-color: rgb(139, 25, 134); | |
| font-size: .9rem; | |
| border-radius: 4px; | |
| overflow: hidden; | |
| outline: none; | |
| cursor: pointer; | |
| box-shadow: 0px 3px 4px 1px rgba(0, 0, 0, 0.158); | |
| transition: box-shadow .2s ease-in; | |
| } | |
| .animated-button::-moz-focus-inner { | |
| border: none; | |
| } | |
| .animated-button::before { | |
| content: ''; | |
| position: absolute; | |
| top: 0; | |
| bottom: 0; | |
| left: 0; | |
| right: 0; | |
| background-color: rgb(255, 255, 255); | |
| opacity: 0; | |
| transition: opacity .2s ease; | |
| } | |
| .animated-button::after { | |
| content: ''; | |
| position: absolute; | |
| top: 50%; | |
| left: 50%; | |
| width: 35px; | |
| height: 35px; | |
| transform: translate(-50%, -50%) scale(1); | |
| padding: 50%; | |
| background-color: white; | |
| border-radius: 50%; | |
| opacity: 0; | |
| transition: opacity .6s ease, transform .7s ease; | |
| } | |
| .animated-button:hover { | |
| box-shadow: 0px 3px 7px 1px rgba(0, 0, 0, 0.253); | |
| } | |
| .animated-button:hover::before { | |
| opacity: .14; | |
| } | |
| .animated-button:focus::before { | |
| opacity: .17; | |
| } | |
| .animated-button:hover:focus::before { | |
| opacity: .3; | |
| } | |
| .animated-button:active::after { | |
| opacity: .32; | |
| transform: translate(-50%, -50%) scale(0); | |
| transition: transform 0s; | |
| } | |
| #container2 { | |
| height: 50%; | |
| background: rgb(2,0,36); | |
| background: linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(101,101,175,1) 17%, rgba(7,46,146,1) 49%, rgba(49,180,228,1) 79%, rgba(0,212,255,1) 100%); | |
| display: flex; | |
| flex-direction: column; | |
| align-items: center; | |
| justify-content: center; | |
| } | |
| .transparent-button { | |
| display: inline-block; | |
| position: relative; | |
| box-sizing: border-box; | |
| border: 2px solid white; | |
| padding: 0 16px; | |
| width: 120px; | |
| height: 40px; | |
| text-align: center; | |
| color: white; | |
| background-color: transparent; | |
| font-size: 1rem; | |
| overflow: hidden; | |
| outline: none; | |
| cursor: pointer; | |
| } | |
| .transparent-button::-moz-focus-inner { | |
| border: none; | |
| } | |
| .transparent-button::after { | |
| content: ''; | |
| position: absolute; | |
| top: 50%; | |
| left: 50%; | |
| width: 35px; | |
| height: 35px; | |
| transform: translate(-50%, -50%) scale(1); | |
| padding: 50%; | |
| background-color: white; | |
| border-radius: 50%; | |
| opacity: 0; | |
| transition: opacity .6s cubic-bezier(.17,.08,.57,-0.26), transform .5s ease; | |
| } | |
| .transparent-button:hover { | |
| background-color: rgba(255, 255, 255, 0.048); | |
| } | |
| .transparent-button:active::after { | |
| opacity: 1; | |
| transform: translate(-50%, -50%) scale(0); | |
| transition: transform 0s; | |
| } | |
| </style> | |
| <body> | |
| <div id="container1"> | |
| <h1> | |
| You need to agree to our | |
| <a href="#" onclick="alert('No term at all!')">terms of service</a> | |
| to continue. | |
| </h1> | |
| <button class="animated-button" onclick="setTimeout(alert.bind(window,'Nothing to confirm!'),800)"> | |
| CONFIRM | |
| </button> | |
| </div> | |
| <div id="container2"> | |
| <h1> | |
| Product that brings businesses together. | |
| </h1> | |
| <button class="transparent-button" onclick="setTimeout(alert.bind(window,'No product at all!'),800)"> | |
| START | |
| </button> | |
| </div> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment