Instantly share code, notes, and snippets.
Last active
December 21, 2017 18:21
-
Star
(0)
0
You must be signed in to star a gist -
Fork
(0)
0
You must be signed in to fork a gist
-
Save chand1012/84fad645855c48bf2087485f7a472615 to your computer and use it in GitHub Desktop.
Simple yet ellegant CSS buttons
This file contains 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
//from https://codepen.io/simonbusborg/pen/cyxad | |
// converted from scss to css | |
:root { | |
--color-dark: #161616; | |
--color-ocean: #416dea; | |
--color-grass: #3dd28d; | |
--color-snow: #fff; | |
--color-salmon: #f32c52; | |
--color-sun: #feee7d; | |
--color-alge: #7999a9; | |
--color-flower: #353866; | |
--color-smoke: #e4e4e4; | |
--font-face: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; | |
} | |
html { | |
box-sizing: border-box; | |
} | |
*, *:before, *:after { | |
box-sizing: inherit; | |
} | |
body { | |
display: flex; | |
box-sizing: border-box; | |
min-height: 100vh; | |
background: whitesmoke; | |
font-family: var(--font-face); | |
font-size: 16px; | |
font-weight: 700; | |
line-height: 1; | |
justify-content: center; | |
align-items: center; | |
} | |
@media (min-width: 992px) { | |
body { | |
border-width: 30px; | |
} | |
} | |
body.linked .button, body.linked h1 { | |
opacity: 0.3; | |
transition: opacity 300ms linear; | |
} | |
body.linked p { | |
color: var(--color-smoke); | |
transition: color 300ms linear; | |
} | |
h1 { | |
text-align: center; | |
transition: opacity 300ms linear; | |
color: var(--color-dark); | |
font-family: var(--font-face); | |
font-size: 32px; | |
font-weight: 700; | |
} | |
h1 span { | |
font-weight: 400; | |
} | |
p { | |
max-width: 460px; | |
margin: 0 auto; | |
transition: color 300ms linear; | |
text-align: center; | |
color: var(--color-dark); | |
font-weight: 400; | |
line-height: 1.5; | |
} | |
a, a:visited { | |
text-decoration: none; | |
color: var(--color-ocean); | |
font-weight: 500; | |
} | |
a:hover, a:visited:hover { | |
text-decoration: underline; | |
color: var(--color-ocean); | |
} | |
.container { | |
display: flex; | |
flex-direction: column; | |
width: 100%; | |
padding: 20px; | |
} | |
.button-container { | |
display: flex; | |
margin: 60px auto; | |
flex-wrap: wrap; | |
justify-content: center; | |
} | |
.button { | |
display: flex; | |
overflow: hidden; | |
margin: 10px; | |
padding: 12px 12px; | |
cursor: pointer; | |
user-select: none; | |
transition: all 150ms linear; | |
text-align: center; | |
white-space: nowrap; | |
text-decoration: none !important; | |
text-transform: none; | |
text-transform: capitalize; | |
color: #fff; | |
border: 0 none; | |
border-radius: 4px; | |
font-size: 13px; | |
font-weight: 500; | |
line-height: 1.3; | |
-webkit-appearance: none; | |
-moz-appearance: none; | |
appearance: none; | |
justify-content: center; | |
align-items: center; | |
flex: 0 0 160px; | |
box-shadow: 2px 5px 10px var(--color-smoke); | |
} | |
.button:hover { | |
transition: all 150ms linear; | |
opacity: 0.85; | |
} | |
.button:active { | |
transition: all 150ms linear; | |
opacity: 0.75; | |
} | |
.button:focus { | |
outline: 1px dotted #959595; | |
outline-offset: -4px; | |
} | |
.button.-regular { | |
color: #202129; | |
background-color: #f2f2f2; | |
} | |
.button.-regular:hover { | |
color: #202129; | |
background-color: #e1e2e2; | |
opacity: 1; | |
} | |
.button.-regular:active { | |
background-color: #d5d6d6; | |
opacity: 1; | |
} | |
.button.-dark { | |
color: var(--color-snow); | |
background: var(--color-dark); | |
} | |
.button.-dark:focus { | |
outline: 1px dotted white; | |
outline-offset: -4px; | |
} | |
.button.-green { | |
color: var(--color-snow); | |
background: var(--color-grass); | |
} | |
.button.-blue { | |
color: var(--color-snow); | |
background: var(--color-ocean); | |
} | |
.button.-salmon { | |
color: var(--color-snow); | |
background: var(--color-salmon); | |
} | |
.button.-sun { | |
color: #f15c5c; | |
background: var(--color-sun); | |
} | |
.button.-alge { | |
color: #e7ff20; | |
background: var(--color-alge); | |
} | |
.button.-flower { | |
color: #fe8cdf; | |
background: var(--color-flower); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is converted from SCSS to CSS by this converter. If you want more info on how to use them, refer to the original code here.